Note that there are some explanatory texts on larger screens.

plurals
  1. POtrying to get a list of events from a calendar using PHP
    primarykey
    data
    text
    <p>I am trying to get a list of events from a calendar. i am looking at developers.google.com/google-apps/calendar/v3/reference/calendarList/list</p> <p>I assume that $service is created from $cal = new apiCalendarService($client); The doc is not very specific.</p> <p>when i try to execute the code below , i get the error PHP Fatal error: Call to a member function getItems() on a non-object</p> <p>but if i do this it works</p> <pre><code>$calendarList = $cal-&gt;calendarList-&gt;listCalendarList(); print "&lt;h1&gt;Calendar List&lt;/h1&gt;&lt;pre&gt;" . print_r($calendarList, true) . "&lt;/pre&gt;"; </code></pre> <p>Also if i try the example code @</p> <p>developers.google.com/google-apps/calendar/v3/reference/events/list#examples I get the same kind of error PHP Fatal error: Call to a member function getItems() on a non-object</p> <p>This works:</p> <pre><code>$events = $cal-&gt;events-&gt;listEvents('rtparies@gmail.com'); print "&lt;h1&gt;Events&lt;/h1&gt;&lt;pre&gt;" . print_r($events, true) . "&lt;/pre&gt;";[/PHP] </code></pre> <p>This fails:</p> <pre><code>foreach($events-&gt;getItems()as $event){ echo $event-&gt;getSummary(); </code></pre> <p>}</p> <p>I can not imagine all these examples are bad, so any suggestions on what i am doing wrong?</p> <p>The example is below :</p> <pre><code>$calendarList = $service-&gt;calendarList-&gt;listCalendarList(); while(true){ foreach($calendarList-&gt;getItems()as $calendarListEntry){ echo $calendarListEntry-&gt;getSummary(); } $pageToken = $calendarList-&gt;getNextPageToken(); if($pageToken){ $optParams = array('pageToken'=&gt; $pageToken); $calendarList = $service-&gt;calendarList-&gt;listCalendarList($optParams); }else{ break; } } </code></pre> <p>Thanks for any help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload