Modified Facebook FBCal to show private events in Gmail Calendar


Recommended Posts

Hi,

Firstly, apologies to mods if this is in the wrong place. I've spent a bit of time modifying the code from gsellis.com (http://www.gsellis.com/2009/06/fbcal/) to solve a common problem and thought I'd post it here in case others want to use it.

There is a known problem with Google Calendar (gCal) and Facebook (FB) whereby private events in Facebook simply show up as "busy" entries in gCal when exported. This is frustrating since the iCal file contains all the data and gCal simply displays it wrong. Gsellis wrote code to obtain the iCal file from FB, set all private flags to public and then output a new iCal file which gCal displayed correctly.

However, I didn't want to just use the FB iCal file as it doesn't show past events and you can't choose whether or not to see events you're not attending / haven't replied to yet. These features are offered by a handy FB app called "FBcal" but the 'private events showing as busy' problem arises again. Therefore, I found a solution using this code:

**Save in a file on your hosting - e.g. cal.php**Add calendar by url in gCal: http://www.yourhost.com/cal.php**

<?php
$ical="**The URL given to you by FBCal - unique for each user and choice of display options**";
$file=file_get_contents($ical);
$search="CLASS:CONFIDENTIAL";
$replace="CLASS:PUBLIC";
$output=str_replace($search,$replace,$file);
header("Content-Type: text/Calendar");
// Give the file a name and force download
header("Content-Disposition: inline; filename=events.ics");
print_r($output);
?>

This requires the FBCal link to be hardcoded as I wasn't sure of the format it took. Mine was:

http://www.fbcal.com/cal/{UID}/40d32f39d2721c1582498520-{UID}/events/ics/attending,unsure/tz/Europe-Dublin

where UID is a unique user ID given in the simple facebook export events link when you login to FB. The facebook link also includes a key, but I'm not sure how this relates to the other string of characters in the link.

So, if other people have had this problem and want to work out how to make it into a general script which can be hosted once and used by many people then that's fine. Equally, if no-one has had this problem and it's just me being picky with my calendar preferences then feel free to consign this to the bin!

EDIT: Just realised the title should be Google Calendar, not Gmail calendar... perhaps a mod could change it to "How to modify Facebook app 'FBCal' to properly display private events in Google Calendar" - Thanks!

  • 3 weeks later...
  • 3 weeks later...
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I'm not unblocking my camera for this crapola. Sorry, Google.
    • Ummmm that is what is it supposed to do. Just turn if off in settings if you do not want it analyzing your open tabs. Chrome does the same thing with Gemini. Sarfari will do the samething after Apple's AI and even more so with the release of their 27 versions that is now powered by Googles LLM/ML models. Understanding why it is doing it and how it can help you vs jumping to some conspiracy theroy is a much better approach. As long as it can be turned off, all is good. Yes the default should be off but the a lot of people would never discover these features.
    • Just another reason (aside from many others) not to use Edge. Firefox 153.0b5 DEx64 has a similar feature added recently in prior builds that I will turn off at some point when I get around to it. It's the new "Something looks suspicious" page that pops up here and there. It cleverly hides itself between web pages that I've actually visited; as a result, you know, of selecting a web page and telling the browser where to go. The interesting thing is that it does not produce these warnings from pages that I, as the only intelligent user of the browser in my system, have ever directed the browser to open! What seems to be happening is that the browser looks at all the goofy ad links on a web page I do actually open and selects one that "looks suspicious" and then creates the "something looks suspicious" web page, which is neatly inserted, as mentioned, between web pages my RB ("real brain") has directed the browser to load in a session. The thing is, I usually look at links I am considering to follow before I ask the browser to load them, and in cases I have noticed where the link does indeed look suspicious, most of the time I will choose to not follow the link at all. Doesn't everyone do this or something similar? I am picky about what I voluntarily load... (I don't like links that start off fine, with a site designaiton that seems normal enough but then is followed by indecipherable alphanumeric strings many, many lines long, etc. I tend to reject those because they look suspicious. They may not be, but I don't care... I'll stay with Firefox, of course, if for no other reason than they usually let you turn off the junk you don't like. And because it isn't Edge... But at some point Microsoft will come to realize that putting your bookmarks on the left side is a Good Thing for a lot of people, just as Microsoft discovered when it had the bright idea of nailing the Windows taskbar to the bottom of the screen, when for decades Microsoft browsers had left that placement up to the user. They have finally reversed the obscenity of that decision. Finally.
    • Google was using the old CATPCHAs data to train their LLMs. What is the say they won't use this camera data of users to train their LLM? these companies need some strict regulations!
  • Recent Achievements

    • One Year In
      BA the Curmudgeon earned a badge
      One Year In
    • Conversation Starter
      rosiecharles earned a badge
      Conversation Starter
    • First Post
      KMilenkoski1202 earned a badge
      First Post
    • First Post
      carols23 earned a badge
      First Post
    • One Month Later
      Tom Willson earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      513
    2. 2
      +Edouard
      259
    3. 3
      PsYcHoKiLLa
      151
    4. 4
      Steven P.
      94
    5. 5
      macoman
      66
  • Tell a friend

    Love Neowin? Tell a friend!