ICS - ical file create using php

Web cal ics file generate in php

$ical = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:".date('Ymd').'T'.date('His')."-".rand()."-example.com
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART;TZID=".$zn.":".$start_time."
DTEND;TZID=".$zn.":".$end_time."
SUMMARY:".$bus_name.' '.$single_serv_name['name'].' ('.$single_calendars_name['name'].')'."
DESCRIPTION;ENCODING=QUOTED-PRINTABLE: ".$description."
X-ALT-DESC;FMTTYPE=text/plain:".$desc."
LOCATION:".$loc_name['name']."
END:VEVENT
END:VCALENDAR\n";
echo $ical;




Download ics file using php


$description = str_replace(array("\r\n", "\n"), array('=0D=0A', '=0D=0A'), $desc);

header("Content-Type: application/force-download;");
header("Content-Disposition: inline; filename=calendar.ics");
echo "BEGIN:VCALENDAR\n";
echo "VERSION:2.0\n";
echo "PRODID:-//Foobar Corporation//NONSGML Foobar//EN\n";
echo "METHOD:PUBLISH\n"; // requied by Outlook
echo "BEGIN:VEVENT\n";
echo "UID:".date('Ymd').'T'.date('His')."-".rand()."-example.com\n"; // required by Outlok
echo "DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook
echo "DTSTART;TZID=".$zn.":".$start_time."\n";
echo "DTEND;TZID=".$zn.":".$end_time."\n";
echo "SUMMARY:".$bus_name.' '.$single_serv_name['name'].' ('.$single_calendars_name['name'].')'."\n";
echo "DESCRIPTION;ENCODING=QUOTED-PRINTABLE: ".$description."\n";
echo "X-ALT-DESC;FMTTYPE=text/plain:".$desc."\n";
echo "LOCATION:".$loc_name['name']."\n";
echo "END:VEVENT\n";
echo "END:VCALENDAR\n";

 

Share this

Related Posts

Previous
Next Post »

1 comments:

comments
29 October 2018 at 22:15 delete

Nice blog post information....nice article used in this blog..keep it up admin....Magento

Reply
avatar

Pageviews from the past week