Eine Datei ics.php erstellen und wie nachfolgend aufgeführt aufrufen
name = $name;
$this->data = "BEGIN:VCALENDAR\nVERSION:2.0\nMETHOD:PUBLISH\nBEGIN:VEVENT\nDTSTART:".date("Ymd\THis\Z",strtotime($start))."\nDTEND:".date("Ymd\THis\Z",strtotime($end))."\nLOCATION:".$location."\nTRANSP: OPAQUE\nSEQUENCE:0\nUID:\nDTSTAMP:".date("Ymd\THis\Z")."\nSUMMARY:".$name."\nDESCRIPTION:".$description."\nPRIORITY:1\nCLASS:PUBLIC\nBEGIN:VALARM\nTRIGGER:-PT10080M\nACTION:DISPLAY\nDESCRIPTION:Reminder\nEND:VALARM\nEND:VEVENT\nEND:VCALENDAR\n";
}
function saveToServer() {
file_put_contents($this->name.".ics",$this->data);
}
function download() {
header("Content-type:text/calendar");
header('Content-Disposition: attachment; filename="'.$this->name.'.ics"');
Header('Content-Length: '.strlen($this->data));
Header('Connection: close');
echo $this->data;
}
}
$start=date($_GET["start"]);
$end=date($_GET["end"]);
$name=$_GET["name"];
$description=$_GET["description"];
$location=$_GET["location"];
$ics = new ICS($start, $end, $name, $description, $location);
$ics->download();
?>
Verwendunghttp://LinkToThisFolder/ics.php?start=2015-03-02%2020:15:00&end=2015-03-03%2015:30:00&name=Titel&description=Beschreibung

Schreibe einen Kommentar