Forum Moderators: coopster

Message Too Old, No Replies

parse .ics (iCalendar) file

need a way to parse the .ics file

         

jpl80

1:59 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



I have a .ics file that I need to parse and store into an array. I can get the file to read into a string but then I need to extract certain values out of the string and store them.

the file has this format

[b]BEGIN:VEVENT[/b]
UID
:27f5cf52-52ec-11da-bbe8-c7bdfcd88f9d
[b]SUMMARY
:build calendar
DESCRIPTION
:PHP calendar project build[/b]
CATEGORIES
:Business
[b]URL
:build_cal.htm[/b]
STATUS
:CONFIRMED
CLASS
:PUBLIC
X-MOZILLA-ALARM-DEFAULT-LENGTH
:0
X
;MEMBER=AlarmEmailAddress
:joker@ncsu.edu
[b]DTSTART
:20051111T145000[/b]
DTEND
:20051111T155000
DTSTAMP
:20051111T194818Z
LAST-MODIFIED
:20051111T200753Z
[b]END:VEVENT[/b]

I need to store DTSTART, SUMMARY, DESCRIPTION, and URL.

Then I need to sort the array by dates (DTSTART).

I think the function sscanf might be appropriate, but I'm a little confused about how to use it.

Any ideas?

Thanks

lobo235

3:57 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Regular Expressions are not my strength but I am sure you would be able to accomplish the task by using them.

whoisgregg

4:03 pm on Nov 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's an open source PHP iCal [sourceforge.net] product out there already. I've not looked at it in a year or so, but I imagine it should suit your needs. :)