title: How can I use PHP to dynamically publish an ical file to be read by Google Calendar?
body: <p>Any Google search on PHP ical just brings up phpicalendar and how to parse or read IN ical files. I just want to write a PHP file that pulls events from my database and writes them out in ical format.</p>
  
  <p>My problem is I can't find anywhere that will answer two questions:</p>
  
  <ol>
  <li>What is the <em>exact</em> ical format, including headers, file format, footers, etc.? In other words, what does the file have to have, exactly, in order to be properly read in by Google Calendar, etc.?</li>
  <li>If I build this file using a .php extension, how do I publish it as ical? Do I have to write to a new .ics file? Or will Google Calendar etc. read a .php file as ical so long as the contents are in the correct format? (Much like a style.css.php file will be read as a CSS file if the contents are actually CSS, etc.)</li>
  </ol>
  
  <p>Any help you all can give or point me to will be greatly appreciated!!!</p>