我刚开始使用Zend Framework在Google日历中创建,更新或删除事件。目前我有这段代码应该检索日历列表,但它不起作用。当我运行页面时,它不显示任何内容,只显示空白页,甚至没有错误。我试着打印'echo hello;'它打印出来,但另一个'回声嗨;'不再打印,所以我假设代码停止在此行'$ calFeed = $ service-> getCalendarListFeed();'
有人可以直接指出我吗?感谢
<?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) {
}
?>
答案 0 :(得分:0)
检索日历列表
$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>";