Dear all,

My issue seems to be a common one but I only find questions about it.
No answers.

I try to post messages to a google calendar using php. Every time I
try to post an event I get the same response:
"The document has moved here" and I can't seem to find a way around
it. I follow the examples I have found but I always get the same
response. Can someone point me in the right direction, please?

I use the zend_Gdata php library to obtain a token:

        $user = 'a...@my-gdata';
        $pass = 'my_pw';
        $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined
service name for calendar
        $client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,
$service);


This produces a variable in the $client object called
"clientLoginToken".
Then I use this token when I post my xml message.
I create my event first.
$postData = "<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gd='http://schemas.google.com/g/2005'
       xmlns:gCal='http://schemas.google.com/gCal/2005'>
  <title type='text'>Little League Schedule</title>
  <summary type='text'>This calendar contains the practice schedule
and game times.</summary>
  <gCal:timezone value='America/Los_Angeles'></gCal:timezone>
  <gCal:hidden value='false'></gCal:hidden>
  <gCal:color value='#2952A3'></gCal:color>
  <gd:where rel='' label='' valueString='Oakland'></gd:where>
</entry>";

Then I define where I want to post it.
$scope = 'http://www.google.com/calendar/feeds/default/allcalendars/
full';

Then I post it using curl
$curl = curl_init($scope);

      curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:
application/atom+xml','Authorization: GoogleLogin auth='.$client-
>getClientLoginToken(),'secure'=>1,'session'=>1) );
      curl_setopt($curl, CURLOPT_POST,
1);
      curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);


The post looks like this in wireshark:
Host: www.google.com

Accept: */*

Content-Type: application/atom+xml

Authorization: GoogleLogin auth=xxxxx
Content-Length: 519



<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gd='http://schemas.google.com/g/2005'
       xmlns:gCal='http://schemas.google.com/gCal/2005'>
  <title type='text'>Little League Schedule</title>
  <summary type='text'>This calendar contains the practice schedule
and game times.</summary>
  <gCal:timezone value='America/Los_Angeles'></gCal:timezone>
  <gCal:hidden value='false'></gCal:hidden>
  <gCal:color value='#2952A3'></gCal:color>
  <gd:where rel='' label='' valueString='Oakland'></gd:where>
</entry>HTTP/1.1 302 Moved Temporarily

Expires: Thu, 24 Sep 2009 14:20:31 GMT

Date: Thu, 24 Sep 2009 14:20:31 GMT

Set-Cookie: S=calendar=p4Tfo3XgE23E7mDSAsGFao-5g;Expires=Fri, 24-
Sep-2010 14:20:31 GMT

Location: 
http://www.google.com/calendar/feeds/default/allcalendars/full?gsessionid=p48fjiroer348989dao

Content-Type: text/html; charset=UTF-8

Content-Length: 278

Cache-Control: private, max-age=0

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

Server: GFE/2.0

X-XSS-Protection: 0


And The reponse from the google server is :"The document has moved".
I read that this problem vanished if one uses

'secure'=>1,'session'=>1 in the HTTPHEADER bu that did not work for
me.

Any help is appreciated,

Thank you,
Rgds /S

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