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

    • Ridiculous claim that the labor cost difference of $6000 annually would increase cost per phone by $200. The employees produce 3 phones per month or what?
    • Sparkle 2.20.1 by Razvan Serea Sparkle is a free, open-source Windows optimization tool designed to make your PC faster, cleaner, and more private. With Sparkle, you can easily debloat Windows by removing unnecessary apps and services, disable Microsoft tracking to enhance privacy, and apply performance tweaks to boost speed. Its cleaner removes junk and temporary files, while every change is safe and fully reversible. Sparkle also features a modern, user-friendly interface with automatic updates, making system maintenance simple. Explore over 39 tweaks, from disabling telemetry and hibernation to optimizing network and game settings, all aimed at customizing and enhancing your Windows experience. Sparkle supports Windows 10 and 11. Sparkle 2.20.1 changelog: You can now change the Animation Direction from Up, Left, or Off. Added configurable animation direction (Up, Left, Off) for improved accessibility Added TTL caching to the system info backend Refactored tweak application flow to await NvidiaProfileInspector Improved IPC listener cleanup to correctly remove specific listeners Fixed online status not updating after successful network requests Updated system info tests to support backend caching Removed electron-toolkit utils dependency in favor of internal is.dev helper Fixed unwanted files and folders being included in application bundles Download: Sparkle 2.20.1 | Portable | ~100.0 MB (Open Source) Links: Sparkle Website | Github | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Never used the G7 Pro, but I've never had a good experience with that style of d-pad and fighting games.
    • And I just bought a seat cushion for my mesh chair. The chair feels nice but the first time I sat in it with boxers, I realized I don't like the feel of mesh on my legs. 😂
    • "This Dell 27 inch 4K 120Hz IPS monitor is really cheap after a very long time" ... Lol.
  • Recent Achievements

    • One Month Later
      JKR earned a badge
      One Month Later
    • Dedicated
      Asgardi earned a badge
      Dedicated
    • Conversation Starter
      jessse3334 earned a badge
      Conversation Starter
    • Reacting Well
      JuvenileDelinquent earned a badge
      Reacting Well
    • One Month Later
      Excellence2025 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      495
    2. 2
      +Edouard
      248
    3. 3
      PsYcHoKiLLa
      154
    4. 4
      Steven P.
      84
    5. 5
      macoman
      64
  • Tell a friend

    Love Neowin? Tell a friend!