0

I use the simpleCalDAV PHP library to work with a CalDAV calendar. So from the server I got information and put it into an array:

$rr = $client->getEvents("20160614T000000Z", "20180615T000000Z");
var_dump($rr);

array(77) {
  [0]=>
  object(CalDAVObject)#5 (3) {
    ["href":"CalDAVObject":private]=> string(91) "..."
    ["data":"CalDAVObject":private]=> string(3405) "..."
    ["etag":"CalDAVObject":private]=> string(13) "..."
  }
  [1]=>
  object(CalDAVObject)#6 (3) {
    ["href":"CalDAVObject":private]=> string(91) "..."
    ["data":"CalDAVObject":private]=> string(3405) "..."
    ["etag":"CalDAVObject":private]=> string(13) "..."
  }
  [1]=> ...

I try to convert it to array, but it fails too:

$array = (array) $rr[0];
var_dump($array);

enter image description here

What can i do?

hnh
  • 13,957
  • 6
  • 30
  • 40
autumnrustle
  • 595
  • 1
  • 10
  • 21

2 Answers2

2

Look at the example.php file. Once you get the response write

  $events = $client->getEvents("20160614T000000Z", "20180615T000000Z");
  echo $events[0]->getData(); `

Everything is in example.php file with examples. Post your output with this if you still have doubt.

Rahul
  • 1,013
  • 1
  • 10
  • 24
0

Try with foreach:

foreach($rr as $key => $value ){
    $value["href"]
    $value["data"]
    $value["etag"]
}
hnh
  • 13,957
  • 6
  • 30
  • 40
demopix
  • 159
  • 6