Hello,

today I´ve got a new failure code while using my workaround to push
events from a webform.

This was the code I get, when I try to add new events, till today it
works perfect, nothing changed in the code:

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with
message 'Expected response code 200, got 401 <HTML> <HEAD>
<TITLE>Authorization required</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"
TEXT="#000000"> <H1>Authorization required</H1> <H2>Error 401</H2> </
BODY> </HTML> ' in /www/htdocs/w00ae078/kalenderla/zend/library/Zend/
Gdata/App.php:661 Stack trace: #0 /www/htdocs/w00ae078/kalenderla/zend/
library/Zend/Gdata.php(220): Zend_Gdata_App->performHttpRequest
('POST', 'http://www.goog...', Array, '<atom:entry xml...',
'application/ato...', NULL) #1 /www/htdocs/w00ae078/kalenderla/zend/
library/Zend/Gdata/App.php(839): Zend_Gdata->performHttpRequest
('POST', 'http://www.goog...', Array, '<atom:entry xml...',
'application/ato...') #2 /www/htdocs/w00ae078/kalenderla/zend/library/
Zend/Gdata/App.php(903): Zend_Gdata_App->post(Object
(Zend_Gdata_Calendar_EventEntry), 'http://www.goog...', NULL, NULL,
Array) #3 /www/htdocs/w00ae078/kalenderla/zend/library/Zend/Gdata/
Calendar.php(164): Zend_Gdata_App->insertEntry(Object(Zend_Gd in /www/
htdocs/w00ae078/kalenderla/zend/library/Zend/Gdata/App.php on line 661

Here is my script:

<?php
//Validierung und Verweis auf Fehlerseite
require_once('recaptcha/recaptchalib.php');
$privatekey = "6LdDMAUAAAAAABwWFffkzHzurIhuaAfV8cWo7DWE";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if(!$resp->is_valid) {
header("location:Fehlerseite.html");
die();
}

// Define credentials for the Google Calendar account
define('GCAL_USER', 'user');
define('GCAL_PASS', 'password');

// If you need to target a specific calendar, uncomment and enter
// its calendar ID here. The calendar ID is available on the
// calendar settings page, next to the Calendar Address buttons.
//define('GCAL_ID', '[[email protected]');

// Include Zend GData client library
require_once '../zend/library/Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

// Get Google Calendar service name (predefined service name for
calendar)
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;

// Authenticate with Google Calendar
$client = Zend_Gdata_ClientLogin::getHttpClient(GCAL_USER, GCAL_PASS,
$service);

function createEvent ($client1, $title = 'Tennis with Beth',
    $desc='Meet for a quick lesson', $where = 'On the courts',
    $startDate = '2009-02-20', $startTime = '10:00',
    $endDate = '2009-02-20', $endTime = '11:00', $tzOffset = '-08')
{
  $gdataCal = new Zend_Gdata_Calendar($client);
  $newEvent = $gdataCal->newEventEntry();

  $newEvent->title = $gdataCal->newTitle($title);
  $newEvent->where = array($gdataCal->newWhere($where));
  $newEvent->content = $gdataCal->newContent("$desc");

  $when = $gdataCal->newWhen();
  $when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
  $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
  $newEvent->when = array($when);
  // Upload the event to the calendar server
  // A copy of the event as it is recorded on the server is returned
  $createdEvent = $gdataCal->insertEvent($newEvent);
  return $createdEvent->id->text;
}

$title = $_POST["title"];
$content = $_POST["content"];
$where = $_POST["where"];
$startDate = $_POST["startDate"];
$startTime = $_POST["startTime"];
$endDate = $_POST["endDate"];
$endTime = $_POST["endTime"];
$cal = $_POST["art"];

createEvent($client, $title, $content, $where, $startDate, $startTime,
$endDate, $endTime, '+01' );
header("Location:Danke.html");
?>

What went wrong? Can anybody help me? I don´t see any mistake in my
code?

kr

Michael

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