我在跟隨有關使用Google Calendar API和ZEND Framework(http://maestric.com/doc/php/google_calendar_api)的教程。我可以通過設置日曆ID:$query->setUser('IDGoesHere');
從我的默認日曆中檢索事件。問題是我不確定如何從我訂閱的所有日曆中獲取事件。有沒有辦法做到這一點,或者甚至不可能?Google日曆PHP從多個日曆中檢索事件
任何幫助表示讚賞。
這裏是PHP:
$path = 'ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$user = 'username';
$pass = 'password';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
try
{
$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);
}
catch(Exception $e)
{
echo "Could not connect to calendar.";
die();
}
$gdataCal = new Zend_Gdata_Calendar($client);
$query = $gdataCal->newEventQuery();
$query->setUser('usernameHere');
$query->setVisibility('private');
$query->setSingleEvents(true);
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortOrder('ascending');
$query->setMaxResults(20);
$event_list = $gdataCal->getCalendarEventFeed($query);
抓住事件並顯示出來: foreach ($event_list as $event) { echo $event->title '; echo $event->where[0]; echo $event->content ; }
向我們展示您的代碼,瞭解您現在如何獲取日曆數據。 – Brad
更新了我的原始帖子。 – downtomike