This did it for me...Thanks for the help..
I hope it can be of use to other people:

$source = file_get_contents('http://xyz.com/ical.ics'); 
$vobj = VObject\Reader::read($source); 

$item=array();
foreach($vobj->VEVENT as $data) {
$eventdate = $data->DTSTART->getDateTime()->format(\DateTime::W3C);;
$result['Date'] = date("l - M jS",strtotime($eventdate)) ; 
$result['Schedule'] = (string)$data->SUMMARY;;
array_push($item,$result);
}
echo json_encode($item,JSON_PRETTY_PRINT); 

Gus 

On Wednesday, June 8, 2016 at 10:59:53 AM UTC-4, Evert Pot wrote:
>
>
>
> On 2016-06-08 7:12 AM, Gus wrote: 
> > Yes that worked! Thank you... 
> > However, having some difficulty as I am trying to convert to a 
> > 2-dimentional json by pulling 'summary' and 'dtstamp' only 
> > 
> > ~~~ 
> > $source = file_get_contents('http://hostname/theicalfee.ics' 
> > <http://hostname/theicalfee.ics'>); 
> > $vobj = VObject\Reader::read($source); 
> > $json = json_encode($vobj); 
> > $contdecode = json_decode($json); 
> > 
> > $item=array(); 
> > foreach ( $contdecode['vevent'] as $value ) { 
> >    $result['Date'] = date("l - M jS",strtotime($value['dtstart'])) ; 
> > $result['Schedule'] = $value['summary']; 
> > array_push($item,$result); 
> > } 
> > 
> > echo json_encode($item,JSON_PRETTY_PRINT);   
>
> Turning it into json and back doesn't make a lot of sense. The whole 
> point of vobject is that it helps you read iCalendar. Plus, you're 
> making a lot of assumptions about how the json structure actually looks 
> like. You should consider taking a look at the actual output of your 
> original json_encode. 
>
> Regardless, you don't need these two lines: 
>
> > $json = json_encode($vobj); 
> > $contdecode = json_decode($json); 
>
> Just work with $vobj directly. There's a whole bunch of documentation on 
> the site: 
>
> http://sabre.io/vobject/icalendar/ 
>
> Evert 
>

-- 
You received this message because you are subscribed to the Google Groups 
"SabreDAV Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sabredav-discuss/196d989c-117a-431b-9c7a-6dbffe451870%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to