Getting Zend_GData Feed for a Specific Google Calendar

北城余情 提交于 2019-12-05 08:52:35

You don't have to manipulate the ID.

If you look at the protocol guide, there's a <link rel="alternate" .../> element which contains the URL you want.

In the PHP client, you can retrieve this link by calling:

// $entry is an instance of Zend_Gdata_Calendar_ListEntry
$link = $entry->getAlternateLink()->getHref();

Also, the documentation you're looking for is here: http://framework.zend.com/apidoc/1.9/Zend_Gdata/Calendar/Zend_Gdata_Calendar_ListEntry.html

I was looking for an answer to this same question and eventually came up with the following:

$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$Client = Zend_Gdata_ClientLogin::getHttpClient('googleaccount','googlepass',$service);
$Service = new Zend_Gdata_Calendar($Client);

$Query = $Service->newEventQuery();
$Query->setUser('calendarid'); # As you know, you can obtain this with getCalendarListFeed()
$Query->setVisibility('public');
$Query->setProjection('full');
$Query->setOrderby('starttime');
$Query->setFutureevents('true');

The part that threw me off at first was that the "user" portion of the call is actually the calendar ID. Then you can do something like:

$events = $Service->getCalendarEventFeed($Query);
foreach ($events as $Event)
{
   // work with Event object here...
}

(The above should really be enclosed in a try/catch, but I'm too lazy to do that here.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!