In which I explain how to create an iCal version of the college football bowl season schedule

2008 – 2009 iCal College Bowl Schedule

Update: Visit collegefootballcalendar.net to subscribe to the latest college football bowl schedule!

CalendarI couldn’t find one anywhere at Yahoo! Sports or on ESPN, so I did some hacking and put together an iCal version of the 2008-2009 College Football Bowl Schedule. You should be able to click that link to “subscribe” to the calendar, which will add all 34 of this season’s bowl games to your iCal or Outlook calendar.

How did I do it?

It was pretty simple, actually, although it took a lot of copying and pasting.

First I created a table in a MySQL database with fields for the name of the bowl, the teams, the city and stadium, and the date and time of each game. Then I created a PHP form so I could add the games to the table. (I had to copy/paste about (34 * 7) times from the ESPN schedule.)
The next step was to add a handler to the .htaccess file in the directory where the .ics file is stored to tell PHP to parse it as if it contained code (instead of just serving it as a web page.)

AddHandler application/x-httpd-php .ics

It took me a couple of tries to get the formatting correct, but eventually I managed to get the PHP right to print each game with the correct details:

<?
     // the header directive tells the web server to tell your browser that this is a calendar file and not a regular web page
	header('Content-type: text/calendar');
	
	$bowls = $db->get_results("select * from bowl");
	
	echo "BEGIN:VCALENDAR";
	echo "\nVERSION:2.0";
	echo "\nMETHOD:PUBLISH";
	echo "\nX-WR-CALNAME:2008-2009 Bowl Calendar (NCAA Football)";
	echo "\nPRODID:-//davidgagne.net//2008-2009 Bowl Calendar (NCAA Football)//EN";

	foreach ( $bowls as $b){
		echo "\nBEGIN:VEVENT";
		echo "\nDTSTART;TZID=US/Eastern:" . date("Ymd", strtotime($b->eventstart)) . "T{$b->eventtime}00";
		echo "\nDTEND;TZID=US/Eastern:" . date("Ymd", strtotime($b->eventstart)) . "T" . ($b->eventtime + 300) . "00";
		echo "\nSUMMARY:{$b->teams} ({$b->bowl})";
		echo "\nLOCATION:{$b->city} ({$b->stadium})";
		echo "\nUID:2008-2009 Bowl Calendar (NCAA Football){$b->bowlid}@davidgagne.net";
		echo "\nSEQUENCE:0";
		echo "\nDESCRIPTION:";
		echo "\nDURATION:PT3H0M";
		echo "\nEND:VEVENT";
	}

	echo "\nEND:VCALENDAR";
?>

I executed that on my web server and then just saved the results as a text file. I opened the file in my iCal to make sure everything worked, and then saved and posted it to this site as an ics file.

There you go. Have fun.


There are 10 comments on this post

  1. What am I doing wrong? See error text from Outlook import

    This error can appear if you have attempted to save a recurring Lunar appointment in iCalendar format.
    To avoid this error, set the appointment option to Gregorian instead of Lunar.

  2. worked great from Google calendar this time. Thanks much!

  3. Thanks, works great. I’ve been searching for this calendar on iCalshare (http://icalshare.com/). You should register it on that site.

  4. I’ve been looking for something like this. Thanks for taking the time to develop it. It works perfectly in iCal!

  5. Thanks man.. I appreciate it!

  6. You are the man, worked great!!!! Now I can sink it with my blackberry.

  7. do you know where i could get the UF baseball schedule for outlook or google cal?

  8. The UF baseball schedule is posted here:
    http://www.gatorzone.com/sched.php?sport=baseb

    There’s a link to import to Outlook at the top of the page.

  9. Could you do this for the 2012-2013 schedule PLEASE!!!!!!!

Add to the discussion:

I'll never share your email address and it won't be published.

What Is This?

davidgagne.net is the personal weblog of me, David Vincent Gagne. I've been publishing here since 1999, which makes this one of the oldest continuously-updated websites on the Internet.

bartender.live

A few years ago I was trying to determine what cocktails I could make with the alcohol I had at home. I searched the App Store but couldn't find an app that would let me do that, so I built one.

Hemingway

You can read dozens of essays and articles and find hundreds of links to other sites with stories and information about Ernest Hemingway in The Hemingway Collection.