0

I have just started using Zend Framework to create, update, or delete events in google calendar. At the moment I have this piece of code that is supposed to retrieve a list of calendars but it is not working. When I run the page it displays nothing, just a blank page and not even an error. I tried printing the 'echo hello;' and it does print it, but the other 'echo hi;' doesn't print anymore, so I assume the code stops working at this line '$calFeed = $service->getCalendarListFeed();'

Can someone point me in the right direct please? Thanks

 <?php
$path = '/home2/bgolaes/public_html/msnh/ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);

// load classes
  require_once 'Zend/Loader.php';
  Zend_Loader::loadClass('Zend_Gdata');
  Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
  Zend_Loader::loadClass('Zend_Gdata_Calendar');
  Zend_Loader::loadClass('Zend_Http_Client');

  // connect to service
  $user = "XXXXX";
  $pass = "XXXXX";
  $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
  $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);

try {
  $service = new Zend_Gdata_Calendar($client);
  echo 'hello';
  $calFeed = $service->getCalendarListFeed();
  echo 'hi';
  echo '<h1>' . $calFeed->title->text . '</h1>';
  echo '<ul>';
  foreach ($calFeed as $calendar) {
  echo '<li>' . $calendar->title->text . '</li>';
}
echo '</ul>';
} catch (Zend_Gdata_App_Exception $e) {

}
?>
Zalif
  • 125
  • 1
  • 12

1 Answers1

0

Retrieving A Calendar List

$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$service = new Zend_Gdata_Calendar($client);



try {
    $listFeed= $service->getCalendarListFeed();
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getMessage();
}

echo "Calendar List Feed";
echo "<ul>";
foreach ($listFeed as $calendar) {
    echo "<li>" . $calendar->title .
         " (Event Feed: " . $calendar->id . ")</li>";
}
echo "</ul>";