Menu

Parse .ics data in iPhone project

Help
Anonymous
2011-02-20
2013-03-23
  • Anonymous

    Anonymous - 2011-02-20

    Hi,
    I am making an iPhone application and i want to use libical to parse .ics dat from an .ics file OR from the URL location of a .ics file..

    Firstly i want to know how i would go about using libical in my project?

    Secondly i want to parse event names and their descriptions,  so i that i can store the event names as variables..

    I was wondering if this was possible using libical.. if so could someone please show me roughly how i may go about implementing this…

    Any and all information will be very much appreciated!

    Thank You For Reading

     
  • nabber00

    nabber00 - 2011-02-21

    You will want to do something like this, see examples.php if the formatting doesn't show up here.  Then use the get_events() function in vCalendar to get an array of vEvent objects to do what you want with:

    <?php

    include("ical.php");

    # Howto open an existing calendar for manipulation
    $myicalfile1 = new ical_File("US32Holidays.ics");

    # get the events from the first calendar in the file
    $vevents = $myicalfile1->components->get_events();

    # loop through calendar events
    print "\n------------------\n";
    foreach ($vevents as $key => $value) {
      // do what you need with $value here
      print $value->get_summary();
      print " - ";
      print $value->get_description();
      print "\n";
    }

    ?>

     

Log in to post a comment.