0

I'm trying to get a feed from a google calendar. It's set to public in the settings and I really believe I got the e-mail and private cookie right.

<html>
<head>
  <title>test</title>
</head>
<body>

  <?php
    set_include_path(get_include_path().PATH_SEPARATOR.'/usr/share/php/libzend-framework-php');
    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');

    $gdataCal = new Zend_Gdata_Calendar();
    $query = $gdataCal->newEventQuery();
    $query->setUser('xxxxxx@gmail.com');
    $query->setVisibility('private-xxxxxxxxxxetc');
    $query->setProjection('full');
    $eventFeed = $gdataCal->getCalendarEventFeed($query);
    foreach ($eventFeed as $event) {
      echo $event->title->text . '<br />';
    }

  ?>
</body>
</html>

But I get an 400-error like this:

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400
Incorrect private url.' in /usr/share/php/libzend-framework-php/Zend/Gdata/App.php:709
Stack trace:
#0 /usr/share/php/libzend-framework-php/Zend/Gdata.php(221): Zend_Gdata_App->performHttpRequest('GET', 'https://www.goo...', Array, NULL, NULL, NULL)
#1 /usr/share/php/libzend-framework-php/Zend/Gdata/App.php(875): Zend_Gdata->performHttpRequest('GET', 'https://www.goo...', Array)
#2 /usr/share/php/libzend-framework-php/Zend/Gdata/App.php(763): Zend_Gdata_App->get('https://www.goo...', NULL)
#3 /usr/share/php/libzend-framework-php/Zend/Gdata/App.php(205): Zend_Gdata_App->importUrl('https://www.goo...', 'Zend_Gdata_Cale...', NULL)
#4 /usr/share/php/libzend-framework-php/Zend/Gdata.php(162): Zend_Gdata_App->getFeed('https://www.goo...', 'Zend_Gdata_Cale...')
#5 /usr/share/php/libzend-framework-php/Zend/Gdata/Calendar.php(107): Zend_Gdata->getFeed('https://www.goo...', 'Zend_Gdata_Cale...')
#6 /var/www/gcal/index.ph in /usr/share/php/libzend-framework-php/Zend/Gdata/App.php on line 709

What could have been going wrong?

The private xml feed url ends with "/basic" so I've tried change $query->setProjection('full'); to $query->setProjection('basic'); But that did'nt work.

Niclas Nilsson
  • 5,691
  • 3
  • 30
  • 43

1 Answers1

0

change

$query->setUser('xxxxxx@gmail.com');

to:

$query->setUser('default');

Or if you want to get events from a sencond calendar. Check this question:

Zend Gdata Calendar Bad Request Error

Community
  • 1
  • 1
Jinzhao Huo
  • 847
  • 11
  • 17