d
Amit DhamuSoftware Engineer
 

Create an ICS file

2 minute read 00000 views
$title = "Event Title";
    $location = "Event Location";
    $desc = "Event Description";
    $today = date("Ymd")."T".date("His")."Z";
    $start_date = "20121225T;
    $start_time = "090000Z";
    $end_date = "20121226T";
    $end_time = "170000Z";

    header("Content-Type: text/calendar");
    header("Content-Disposition:inline; filename=$title.ics");
    header('Content-Transfer-Encoding: binary');
    echo "BEGIN:VCALENDAR\n";
    echo "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\n";
    echo "VERSION:2.0\n";
    echo "METHOD:PUBLISH\n";
    echo "X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n";
    echo "BEGIN:VEVENT\n";
    echo "CLASS:PUBLIC\n";
    echo "CREATED:$today\n";
    echo "DESCRIPTION:$titlen$description\n";
    echo "DTEND:".$end_date.$end_time."\n";
    echo "DTSTAMP:$today\n";
    echo "DTSTART:".$start_date.$start_time."\n";
    echo "LAST-MODIFIED:$today\n";
    echo "LOCATION:$location\n";
    echo "PRIORITY:5\n";
    echo "SEQUENCE:0\n";
    echo "SUMMARY;LANGUAGE=en-us:$title\n";
    echo "TRANSP:OPAQUE\n";
    echo "UID:040000008200E00074C5B7101A82E008000000008062306C6261CA01000000000000000\n";
    echo "X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n";
    echo "X-MICROSOFT-CDO-IMPORTANCE:1\n";
    echo "X-MICROSOFT-DISALLOW-COUNTER:FALSE\n";
    echo "X-MS-OLK-ALLOWEXTERNCHECK:TRUE\n";
    echo "X-MS-OLK-AUTOFILLLOCATION:FALSE\n";
    echo "X-MS-OLK-CONFTYPE:0\n";
    echo "BEGIN:VALARM\n";
    echo "TRIGGER:-PT1440M\n";
    echo "ACTION:DISPLAY\n";
    echo "DESCRIPTION:Reminder\n";
    echo "END:VALARM\n";
    echo "END:VEVENT\n";
    echo "END:VCALENDAR\n";