2012-03-05 65 views
0

我試圖從Google日曆中獲取Feed。它設置爲公開,我真的相信我的電子郵件和私人cookie是正確的。從Feed中獲取帶有魔術餅乾的Google日曆

<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('[email protected]'); 
    $query->setVisibility('private-xxxxxxxxxxetc'); 
    $query->setProjection('full'); 
    $eventFeed = $gdataCal->getCalendarEventFeed($query); 
    foreach ($eventFeed as $event) { 
     echo $event->title->text . '<br />'; 
    } 

    ?> 
</body> 
</html> 

但我得到一個400錯誤是這樣的:

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 

什麼,本來回事?

專用xml提要url以「/ basic」結尾,所以我試過改變$query->setProjection('full');改爲$query->setProjection('basic');但這沒有奏效。

回答