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.