Display an RSS Feed in iCal
31 May 2007

This is a quick and dirty php script I wrote up to convert an RSS feed into ics format so I could display it in iCal. It uses MagpieRSS to parse the RSS, then creates an event for each item. There is plenty of room for improvement here, but it’s working - in the screenshot above I have iCal subscribed to my feed, Daring Fireball, and FlickrBlog.
To do:
- Include the main description of the items in the event description. This is simple enough, but I need a function to format the descriptions so they are compatible with ics.
- I’d like to add a couple of query string options, in particular an option to display events as ‘all day’ events, instead of at a time.
- The hCalendar microformat looks pretty interesting, but that’s another job entirely.
To use, download the script and upload to your server (or use from your local server). In iCal, select Calendar > Subscribe…, and enter the path in the format http://path/to/rss-ics.php?url=http://path/to/feed/.
In it’s current form it’s not particularly useful, but I have a few ideas already, and if anyone comes up with anything interesting using this I’d love to hear about it.
Update: Should now handle feeds that store the date in the dc:date field as well as those using pubDate.
Update: This works great for facebook status feeds.



Jamie
10 June 2007 @ 7:33 am
Just read about this over at TUAW and it sounds really interesting. If it worked with the RSS feeds coming out of 37signals ‘Basecamp’ then it would be really useful. The global RSS feed logs to-do items that have been added/completed. I assume it would plan them to iCal giving an overview of what’s been achieved on any particular day. I just wish I knew anything enough about PHP to try it!
Tom Henderson
11 June 2007 @ 1:09 am
To use basecamp’s RSS feed you just need to enter the username and password into the url in the following format: url=http://username:password@path/to/feed/. Note that your password will be sent unencrypted.
Joe
3 October 2007 @ 5:46 am
Awesome script, thanks!
Nikolas Schrader
17 October 2007 @ 8:23 pm
Isn´t it bad, that you only can add Blogs where this script is on the server?… But this script is really great, thanks!
Tom Henderson
21 October 2007 @ 11:41 am
The script can be run from your own server, or even locally on your built in server. It reads the rss feed you specify so the site doesn’t need to run the script.
Joel de Bruijn
27 December 2007 @ 10:15 am
I will try this to import my lifestream to google calendar. My lifestream is wwww.blogisch.nl, but I want to have a copy in Google Calender…
Joel de Bruijn
27 December 2007 @ 11:03 am
Yes, it works like a charm!
Thanks for the code!
Here’s what I did:
- setup a sub-domain, to make the script public available.
- put MagpieRSS and your script online.
- Added a Calender in Google Calender, via URL. The URL points to your script, with the RSS feed as a parameter.
- Looked at GCal: yes! I makes a copy of my lifestream.
Keep up the good work.
Lifestream kopie in Google Calendar
28 December 2007 @ 7:35 am
[...] BlogTender kwam ik een stukje php-script tegen dat RSS feeds omzet naar iCal formaat. Als deze via een URL in [...]
Livestream van Joël de Bruijn » Blog Archive » Lifestream kopie in Google Calendar
2 January 2008 @ 6:31 am
[...] BlogTender kwam ik een stukje php-script tegen dat RSS feeds omzet naar iCal formaat. Als deze via een URL in [...]
Matt Cooney
28 January 2008 @ 9:44 am
This wasn’t working with my atom feed, so I inserted this at line 46:
if (!$rfc3339) $rfc3339 = $item['published'];I’m sure there are more elegant ways to do it, but it worked for me and maybe it will help someone. (You need a reasonably recent version of MagpieRSS.)
Thanks for the cool script!