我正在尝试将谷歌日历集成到我的 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' 没有被打印,也没有捕获到异常!我用我在谷歌日历中找到的cookie替换了getCalendarEventEntry中的xxxxxxx(日历->设置>日历的URL地址-> XML)
我做错了什么?谢谢您的帮助