// merges four sport calendar feeds โ one clean subscription url
A single PHP script that acts as a personal iCal aggregator for sports schedules. It fetches four public Google Calendar feeds (baseball, basketball, hockey, and football), merges them into one combined feed, slaps the right emoji on each event so you know which sport you're looking at at a glance, and drops any game that has already ended so your calendar stays clean.
Subscribe to sports-calendar.php once
in Google Calendar and you're done โ no app, no account, no fuss.
| Feature | Detail | |
|---|---|---|
| ๐ | Merged feed | All four sports in one .ics subscription URL |
| ๐ท๏ธ | Emoji labels | โพ ๐ ๐ ๐ prepended to every event title automatically |
| ๐งน | Auto-cleanup | Completed games are filtered out on every request โ no stale clutter |
| โก | No dependencies | Pure PHP, no libraries, no Composer โ just upload and go |
| ๐ | Always fresh | Re-fetches source calendars on every poll; 1-hour cache header for Google |
In Google Calendar, click the + next to Other calendars and choose From URL.
Paste in the URL of this script:
https://dcsports.stevenglassman.com/sports-calendar.php
Click Add calendar. Google will import it and start showing games. Done! ๐
| Sport | Source URL | |
|---|---|---|
| โพ | Baseball (MLB) | โฆ4effb802โฆ/basic.ics |
| ๐ | Basketball (NBA) | โฆ184f235cโฆ/basic.ics |
| ๐ | Hockey (NHL) | โฆ8be63d02โฆ/basic.ics |
| ๐ | Football (NFL) | โฆ3kooo1l2โฆ/basic.ics |
To add, remove, or swap a calendar, edit the $CALENDARS array at the top of
sports-calendar.php and re-upload.
When Google Calendar polls the URL, the script fetches all four source
.ics feeds in sequence, parses out the VEVENT blocks, checks each
event's DTEND (or end-of-day on DTSTART for all-day events) against
the current UTC time, drops anything in the past, prepends the sport emoji to the
SUMMARY field, and streams the merged result as a valid iCal document.
The script handles all three iCal date formats: UTC datetime
(20240101T120000Z), floating datetime (20240101T120000),
and all-day date values (20240101). Events with no end time fall back to
end-of-calendar-day so they still get cleaned up promptly.
file_get_contents() is disabled on the server. Contact your
host or swap the fetch function for a cURL equivalent โ a commented fallback is easy to add.
$CALENDARS = [
[
'url' => 'https://...your-ics-url...',
'emoji' => 'โฝ', // โ change to any emoji you like
],
// add as many entries as you want
];
Any number of source calendars is supported โ just add more entries to the array.
The output calendar name is set via the X-WR-CALNAME header near the
bottom of the script.