I had to do this for a party page I created... Here's the splash of code I
use (please keep in mind I wrote this like 5 years ago, so it's pretty
ass-code, but it works and I don't care enough about it to clean it up):
if (isset($_GET['id']) && intval($_GET['id'] > 0))
{
$sql = "SELECT *,
UNIX_TIMESTAMP(party_date) AS start,
UNIX_TIMESTAMP(DATE_ADD(party_date, INTERVAL 3
HOUR)) AS end,
UNIX_TIMESTAMP(DATE_ADD(party_date, INTERVAL 7
HOUR)) AS GMTstart,
UNIX_TIMESTAMP(DATE_ADD(DATE_ADD(party_date,
INTERVAL 3 HOUR), INTERVAL 7 HOUR)) AS GMTend,
UNIX_TIMESTAMP(DATE_ADD(NOW(), INTERVAL 7 HOUR)) AS
GMTnow
FROMparty_table
WHERE party_id = ".intval($_GET['id'])." LIMIT 1";
//echo $sql;
$pth = mysql_query($sql, $db);
if ($pth && mysql_num_rows($pth) == 1)
{
$prow = mysql_fetch_array($pth,MYSQL_ASSOC);
//http://www.phpbuilder.com/columns/chow20021007.php3?page=2
//http://www.sitellite.org/docs/Date/vCal.html
//http://www.scheduleworld.com/outlookInteroperability.html
//http://www.ietf.org/rfc/rfc2445.txt
//http://www.linuxjournal.com/article/8159
//header("Content-Type: text/x-vCalendar");
$Filename = "Event [" . $_GET['id'] . "].ics";
header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=".$Filename);
//$DescDump = str_replace("\r", "=0D=0A",
$prow['party_description']);
if ($prow['party_other_url'])
$body .= "Other URL: ".$prow['party_other_url']."\r\n";
$body .= "\r\n".$prow['party_description'];
$DescDump =
str_replace(array("\r\n","\r",'','','',''), "\\n", $body);
$vCalStart = date("Ymd\THi00", $prow['GMTstart']);
$vCalEnd = date("Ymd\THi00", $prow['GMTend']);
$vCalNow = date("Ymd\THi00", $prow['GMTnow']);
?>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:RBC Web Calendar
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:Z
DTEND:Z
LOCATION:
TRANSP:OPAQUE
SEQUENCE:0
UID:1234567890RBC
DTSTAMP:Z
DESCRIPTION:
SUMMARY:
PRIORITY:1
X-MICROSOFT-CDO-IMPORTANCE:2
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT60M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
Calendar".mysql_errno().":
".mysql_error()."\n"; exit; }
} //if vcal
> -Original Message-
> From: Bastien Koert [mailto:phps...@gmail.com]
> Sent: Tuesday, June 23, 2009 12:31 PM
> To: Jason Paschal
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] iCal Attachment Format ?
>
> On Tue, Jun 23, 2009 at 3:09 PM, Jason
> Paschal wrote:
> > Hi all!
> >
> > Built an appointment scheduling app, but now the client
> wants it to send out
> > an email with the appt attached in iCal format. I've never
> dealt with
> > anything iCal before.
> >
> > I searched around a bit, and know that there iCal php
> scripts available, but
> > I don't need a bunch of rigamarole, just need to create the
> attachment and
> > send it on the fly.
> >
> > But I'm having trouble finding the format. Anyone know
> what this looks
> > like? Or can point me to a resource?
> >
> > Rather not scrounge thru someone else's code, or have to
> install something
> > just to run it for the format...if I can help it. :)
> >
> > Thank you,
> >
> > Jason
> >
>
> STFW like at http://en.wikipedia.org/wiki/ICalendar
>
> --
>
> Bastien
>
> Cat, the other other white meat
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php