http://web.archive.org/web/20120419230026/http://jamiebicknell.tumblr.com/post/413492676/ics-generator-php-class
Nota: entrada del blog original se ha perdido; conservando con el enlace arhcive.org.
Copiar y pegar la información del enlace de arriba:
<?php
class ICS {
var $data;
var $name;
function ICS($start,$end,$name,$description,$location) {
$this->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 save() {
file_put_contents($this->name.".ics",$this->data);
}
function show() {
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;
}
}
?>
de salida del archivo ICS para el navegador y dar al usuario la opción de abrir o guardar
<?php
$event = new ICS("2009-11-06 09:00","2009-11-06 21:00","Test Event","This is an event made by Jamie Bicknell","GU1 1AA");
$event->show();
?>
Guardar la Archivo ICS en el servidor en el directorio de trabajo actual
<?php
$event = new ICS("2009-11-06 09:00","2009-11-06 21:00","Test Event","This is an event made by Jamie Bicknell","GU1 1AA");
$event->save();
?>
Bienvenido a SO, preguntas simplemente buscando algo así como un tutorial o código sin mostrar sus propios esfuerzos (p. cuál es su implementación actual, por qué no es adecuado) normalmente se consideran fuera del tema y se cerrarán y luego se eliminarán. – hakre