Also, you may want to checkout the send_request() on this tip I
posted:
http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-php.html

It's a nice utility.

Eric

On Jan 13, 10:17 am, "Eric (Google)" <[email protected]> wrote:
> Sorry, I was suggesting a packet capture to help debug.
>
> Try leaving out the Content-Length.  If I remember correctly,
> curl automatically calculates that for you.  This worked for me:
>
> <?php
> $xmlstr ='<?xml version="1.0" encoding="UTF-8"?>
> <atom:entry xmlns:atom="http://www.w3.org/2005/Atom";>
>   <atom:category scheme="http://schemas.google.com/g/2005#kind";
>       term="http://schemas.google.com/docs/2007#folder"; label="folder"/
>
>   <atom:title>Example Folder</atom:title>
> </atom:entry>';
>
> $token = 'AUTHTOKEN';
> $headers = array(
>   'Authorization: AuthSub token=' . $token,
>   'Content-Type: application/atom+xml',
> );
>
> $ch = curl_init("http://docs.google.com/feeds/documents/private/
> full");
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlstr);
> $response = curl_exec($ch);
> curl_close($ch);
>
> echo htmlentities($response);
> ?>
>
> Eric
>
> On Jan 13, 10:00 am, alain <[email protected]> wrote:
>
> > Hi Eric:
> > I make a POST request with Curl as usual...
> > I remark that the length of the XML string in the Google example(384)
> > that I use, is different from the length I get from the actual string
> > (309). Is it possible that something is missing in the string?
> > Also I never had to use a packet capture with Google services, Is that
> > necessary in this case?
> > Alain
>
> > On Jan 12, 6:09 pm, "Eric (Google)" <[email protected]> wrote:
>
> > > Hi Alain,
>
> > > That looks about right, but how are you making the request?
> > > Also, a packet capture might help.
>
> > > Eric
>
> > > On Jan 12, 2:08 pm, alain <[email protected]> wrote:
>
> > > > I use the Authsub (in PHP) as:
> > > >                                 
> > > > $requestURL="http://docs.google.com/feeds/documents/private/full";;
> > > >                                 $xmlstr ='<?xml version="1.0" 
> > > > encoding="UTF-8"?>
> > > >                                 <atom:entry 
> > > > xmlns:atom="http://www.w3.org/2005/Atom";>
> > > >                                  <atom:category 
> > > > scheme="http://schemas.google.com/g/2005#kind";
> > > >                         
> > > > term="http://schemas.google.com/docs/2007#folder";
> > > > label="folder"/>
> > > >                                 <atom:title>Example Folder</atom:title>
> > > >                                 </atom:entry>';
>
> > > >                                 $cl= strlen($xmlstr);
> > > >                         $header = array("Content-type: 
> > > > application/atom+xml","Content-
> > > > Length: \"$cl\"","Authorization: AuthSub token=\"$autosec\"");
> > > > and get a 401 error, where is the error?
> > > > Thanks
> > > > Alain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" 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-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to