I'm trying out this page and after recompiling PHP to support SSLv2
and adding the Zend library to my includes, I'm getting the following
error:
Zend_Feed_Exception: Feed failed to load, got response code 302 in /
home/httpd/libs/Zend/Feed.php on line 177
Call Stack
# Time Memory Function Location
1 0.0012 106412 {main}( ) ../google_event_create.php:0
2 0.6721 1375344 gcal_EnumCalendars( ) ../google_event_create.php:128
3 0.6722 1375344 Zend_Gdata_Calendar->getCalendarListFeed( ) ../
google_event_create.php:143
4 0.6722 1375344 Zend_Gdata->getFeed( ) ../Calendar.php:111
5 0.6722 1374880 Zend_Feed::import( ) ../Gdata.php:121
Anyone have any ideas?
I know my $client connection is established and authenticated because
I can submit an event to my default calendar.
On May 16, 11:20 pm, "Lane LiaBraaten (Google)"
<[EMAIL PROTECTED]> wrote:
> Hi Paul,
>
> Thanks for posting your solution! This looks like a good candidate
> for the Tips and Tricks
> pagehttp://groups.google.com/group/google-calendar-help-dataapi/web/tips-....
> Then people may post how this can be done using the other client
> libraries.
>
> Cheers,
> Lane
>
> On May 7, 10:25 am, Andrew <[EMAIL PROTECTED]> wrote:
>
> > I had problems with this for a long time and was finally able to
> > figure it out by skimming a lot of other posts...maybe having this
> > code all in one place will help others too!
>
> > The basic method is this:
> > - Authenticate and get a valid Zend_Http_Client object
> > - Use the client object to get a Zend_Gdata_Calendar object
> > - Call getCalendarListFeed to get a list of calendars
> > - Retrieve the user id of the calendar you wish to query (The user id
> > is a part of the calendar's "id" field in the list feed...it's the
> > part at the end, after "http://www.google.com/calendar/feeds/
> > default/". For your default calendar, it is your email address. Other
> > calendars have randomly generated user id's)
> > - Use the functions setUser (with the user id of the desired
> > calendar), setVisibility, setProjection, setOrderBy, and possibly
> > setStartMin and setStartMax, to prepare the calendar object
> > - Call getCalendarFeed() to get a feed from the calendar you
> > specified!
>
> > <code>
> > /**
> > * Get a list of user's calendars
> > *
> > * @author Andrew Richardson (http://pc.byethost10.com)
> > * @param Zend_Http_Client $client
> > * @return array associative array of calendars (title => user_id)
> > */
> > function gcal_EnumCalendars($client) {
> > $cal = new Zend_Gdata_Calendar($client);
> > $calFeed = $cal->getCalendarListFeed();
>
> > $calendars = array();
> > foreach ($calFeed as $calendar) {
> > # Get the calendar's actual name
> > $title = $calendar->title();
>
> > # Look for an override name (if user has renamed a
> > calendar that
> > was shared with them)
> > $override =
> > $calendar->getDOM()->getElementsByTagName('overridename');
>
> > foreach($override as $o) {
> > $title = $o->getAttribute('value');
> > }
>
> > # Add this calendar to the array
> > $feed = explode('/', $calendar->id());
> > $calendars[$title] = urldecode($feed[6]);
> > }
> > return $calendars;
> > }
>
> > /**
> > * Get events from a calendar
> > *
> > * @author Andrew Richardson (http://pc.byethost10.com)
> > * @param Zend_Http_Client $client
> > * @param string $id user_id of calendar to use (defaults to
> > 'default')
> > * @param integer $first in epoch seconds, the minimum date to list
> > (defaults to today)
> > * @param integer $last in epoch seconds, the maximum date to list
> > (defaults to infinity)
> > * @return array associative array of events (title => ('start' =>
> > start, 'end' => end))
> > */
> > function gcal_GetEvents($client, $id, $first, $last) {
> > $cal = new Zend_Gdata_Calendar($client);
> > if(isset($id)) $cal->setUser($id);
> > else $cal->setUser('default');
> > $cal->setVisibility('private');
> > $cal->setProjection('full');
> > $cal->setOrderby('starttime');
>
> > # Default range is from today until the end of time
> > if(!isset($first)) $first = time();
> > $firstdate = getdate($first);
> > $cal->setStartMin($firstdate['year'] . '-' .
> > $firstdate['mon'] .
> > '-1');
>
> > if(isset($last)) {
> > $lastdate = getdate($last);
> > $cal->setStartMax($lastdate['year'] . '-' .
> > $lastdate['mon'] .
> > '-1');
> > }
>
> > # Parse the date of each event
> > $eventFeed = $cal->getCalendarFeed();
> > $events = array();
> > foreach ($eventFeed as $eventFeed) {
> > $start = strtotime(
> > $eventFeed->{'gd:when'}['startTime'] );
> > $end = strtotime(
> > $eventFeed->{'gd:when'}['endTime'] );
>
> > $event = array("start" => $start, "end" => $end);
> > $events[ $eventFeed->title() ] = $event;
> > }
>
> > return $events;
> > }
> > </code>
>
> > An example use of the code, assuming I have a valid client object
> > already, and assuming my Google Calendar account includes a non-
> > default calendar entitled "Work Schedule":
> > <code>
> > $calendars = gcal_EnumCalendars($client);
> > $events = gcal_GetEvents( $client, $calendars['Work Schedule'] );
> > foreach($events as $title => $event) {
> > print $title;
> > print_r( $event );}
>
> > </code>
>
> > On Apr 24, 8:12 pm, Paul <[EMAIL PROTECTED]> wrote:
>
> > > I posted this tohttp://www.nabble.com/Zend-gdata-f16698.htmlbut
> > > didn't get a response. I searched the net and this group's archives
> > > but met a similarly unproductive fate.
>
> > > I've managed to write a command-line PHP program that uses
> > > ClientLogin to access my users'sdefaultcalendar("A"). When I do a
> > > $eventFeed = $gdataCal->getCalendarFeed(), I get back a feed
> > > ($eventFeed) happily listing all of the events in mydefaultcalendar
> > > ("A"). When I $myCalendarList = $gdataCal->getCalendarListFeed(), I
> > > get back a feed listing all of 5 of calendars ("A", "B", "C", "D" and
> > > "E")... but there are no events in the $myCalendarList object, as you
> > > might (correctly) infer from the name of the getCalendarListFeed
> > > function.
>
> > > How do I combine these two ideas (1-getting acalendar'sevents and 2-
> > > getting a listing of my calendars) to access the events in my
> > > non-defaultcalendar?
>
> > > Thanks for any assistance,
>
> > > --Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---