Reputation: 5732
I am retrieving events from my CalDAV server and I have to process them now. This is how the events look like:
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:20141203T144713Z
DTSTART:20141202T130000
DTEND:20141202T152000
UID:1047
DESCRIPTION:
LOCATION:
SUMMARY:ysdasdfasdfasdf
END:VEVENT
END:VCALENDAR
or if added through iCalendar (Apple):
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Apple Inc.//iOS 8.1.1//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Zurich
BEGIN:DAYLIGHT
DTSTART:19810329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
TZNAME:MESZ
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19961027T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
TZNAME:MEZ
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20141210T143342Z
DTEND;TZID=Europe/Zurich:20141212T160000
DTSTAMP:20141210T143343Z
DTSTART;TZID=Europe/Zurich:20141212T150000
LAST-MODIFIED:20141210T143342Z
SEQUENCE:0
SUMMARY:bala
TRANSP:OPAQUE
UID:3681EC54-5198-4159-870D-6DAC4B1E302B
END:VEVENT
END:VCALENDAR
I did not find any good PHP implementation for parsing those CalDAV events. If there are none, what is the best way to parse them?
Upvotes: 0
Views: 3320
Reputation: 5732
I ended up using ics-parser and it's enhancement on Github that implements recurrence.
Upvotes: 1
Reputation: 1141
I would advice You to read about recursive descent parsing. f.e. http://www.slideshare.net/relaxnow/recursive-descent-parsing
Upvotes: 2