PHP Google日历API:删除事件

时间:2012-08-08 10:50:36

标签: zend-framework google-calendar-api

我正在尝试将谷歌日历集成到我的php应用程序中。我正在使用Zend框架。我设法添加和检索事件。但删除事件对我不起作用。这是我的代码(我从IBM的教程中复制了)

<?php
// 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    
$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = "username@gmail.com";
$pass = "pass";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
echo 'I m connected ';
$gcal = new Zend_Gdata_Calendar($client);    

// retrieve event
// delete event
try {   


  $event = $gcal->getCalendarEventEntry('http://www.google.com/calendar/
   feeds/default/private/full/xxxxxxxxxxxx');
echo 'eventUrl got';
  $event->delete();
echo 'deleted';
} catch (Zend_Gdata_App_Exception $e) {
  echo "Error: " . $e->getResponse();
}        
echo 'Event successfully deleted!';  
?>

事件未被删除。'eventUrl got'未打印且异常未被捕获!我用getCalendarEventEntry中的xxxxxxx替换了我在谷歌日历中找到的cookie(日历 - &gt;设置&gt;日历 - > XML的URL地址)
我究竟做错了什么 ? 谢谢你的帮助

0 个答案:

没有答案