Facebook Event exports take two
February 08, 2013
So a while ago I wrote a php script to make facebook event names appear properly on google calendar.
I've since noticed that all 'full day' events on facebook get exported as though they are on the previous day! Someone has written a page to do this, but the source code is not available and so it depends if you trust them with your events or not.
As such I updated my php script to do this date change too! Code below, but if you want to use it on my site:
http://www.psykar.com/utils/cal.php?uid=<uid>&key=<key>
Get the uid and the key from your events page on facebook by clicking the gear in the top right, and export events, then get the URL of 'upcoming events'.
For adding this to google calendar use webcal:// instead of http://
add(new DateInterval('P1D')); return "DT".$matches[1].":".$date->format('Ymd'); } $ical = "https://www.facebook.com/ical/u.php?uid=".$_GET['uid']."&key=".$_GET['key']; $file=file_get_contents($ical); $pattern = "#DT(START|END):([0-9]{8})[\n\r]#"; $file = preg_replace_callback($pattern, "inc_date", $file); $search="CLASS:PRIVATE"; $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); ?>