Hi all,

I also have problems getting RC2 code to work. If I follow the Zend
documentation. Listing calendars and events is ok, but creating new
events and updating existing ones gives exceptions.

My code:

<?php
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');

// Parameters for ClientAuth authentication
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = "[EMAIL PROTECTED]";
$pass = "--------";

// Create an authenticated HTTP client
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
$service);


// Create an instance of the Calendar service
$service = new Zend_Gdata_Calendar($client);

try {
    $listFeed= $service->getCalendarListFeed();
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getResponse();
}

echo "<h1>Calendar List Feed</h1>";
echo "<ul>";
foreach ($listFeed as $calendar) {
    echo "<li>" . $calendar->title . " (Event Feed: " . $calendar-
>id . ")</li>";
}

$query = $service->newEventQuery();
$query->setUser('default');
// Set to $query->setVisibility('private-magicCookieValue') if using
MagicCookie auth
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');

// Retrieve the event list from the calender server
try {
    $eventFeed = $service->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getResponse();
}

// Iterate through the list of events, outputting them as an HTML list
echo "<ul>";
foreach ($eventFeed as $event) {
    echo "<li>" . $event->title . " (Event ID: " . $event->id . ")</
li>";
}
echo "</ul>";

// Get the first event in the user's event list
$event = $eventFeed[0];
// Change the title to a new value
$event->title = $service->newTitle("Woof!");

// Upload the changes to the server
try {
    $event->save();
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getResponse();
}

?>

The response:

# Erik J--------- (Event Feed: 
http://www.google.com/calendar/feeds/default/ej--------------%40gmail.com)
    * Test (Event ID: 
http://www.google.com/calendar/feeds/default/private/full/------------------------------)


Notice: Array to string conversion in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Undefined offset: 1 in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Array to string conversion in /home/www/---/zend/library/Zend/
Gdata/App.php on line 487

Notice: Undefined offset: 1 in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Array to string conversion in /home/www/
sunshinetranslations.com/zend/library/Zend/Gdata/App.php on line 487

Notice: Undefined offset: 1 in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Array to string conversion in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Undefined offset: 1 in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Array to string conversion in /home/www/---/library/Zend/Gdata/
App.php on line 487

Notice: Undefined offset: 1 in /home/www/---/library/Zend/Gdata/
App.php on line 487

Fatal error: Class 'Zend_Gdata_App_HttpException' not found in /home/
www/---/library/Zend/Gdata/App.php on line 494




On 9 jun, 03:54, Trevor Johns <[EMAIL PROTECTED]> wrote:
> On Jun 8, 4:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > I dont think I am suppose to use the API...  LOL
>
> > I got the RC2 code to work on a limited basis,  I can list and view
> > items, but I a cant seem to add a new event.  It gives me all types of
> > errors.  :-)
>
> Hello,
> I'd be happy to help, but first I need to see your code so that I can
> see what's causing the errors. :)
>
> In the meantime, make sure you're looking at the right documentation.
> The docs at code.google.com are still for the 0.9 branch and are
> incompatible with the version of the GData library in Zend Framework
> 1.0. Until those get updated, this page at framework.zend.com would be
> your best source for instructions:
>
>    http://framework.zend.com/manual/en/zend.gdata.calendar.html
>
> You might also want to take a look at the Calendar sample code, which
> also includes a demonstration on how to create events:
>
>    http://framework.zend.com/svn/framework/trunk/demos/Zend/Gdata/Calend...
>
> --
> Trevor Johnshttp://tjohns.net/


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to