Hi,

In general, you should use a multi-use/long-lived ausub token
by requesting one with session=1 instead of using a session=0
(single-use) AuthSub token.  You _can_ use a single-use token,
but it will be invalidated after that use.

There's also a great PHP4 resource here (if you haven't already seen
it):
http://code.google.com/apis/base/samples/php/php-sample.html

Eric

On Sep 9, 12:57 pm, sridevi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am using php 4.x and trying to make a test insertion with curl.
> <?php
> $items_array = "<?xml version='1.0'?>" . "\n";
> $items_array .= "<entry xmlns='http://www.w3.org/2005/Atom'
> xmlns:g='http://base.google.com/ns/1.0'>" . "\n";
> $items_array .= "<category scheme='http://base.google.com/categories/
> itemtypes' term='Products'/>" . "\n";
> $items_array .= "<g:item_type>products</g:item_type>" . "\n";
> $items_array .= "<author>" . "\n";
> $items_array .= "<name>Sridevi</name>" . "\n";
> $items_array .= "<email>[EMAIL PROTECTED]</email>" . "\n";
> $items_array .= "</author>" . "\n";
> $items_array .= "<title>Sridevi</title>" . "\n";
> $items_array .= "<g:price>2,625.90</g:price>" . "\n";
> $items_array .= "<g:quantity>10</g:quantity>" . "\n";
> $items_array .= "</entry>" . "\n";
> $ch = curl_init();    /* Create a CURL handle. */
>                 /* Prepare the data for HTTP PUT. */
>                 $putString = $items_array;
>                 $putData = tmpfile();
>                 fwrite($putData, $putString);
>                 fseek($putData, 0);
>
> $token="CMD678GhExCyv9zyAw";
> $developerKey="ABQIAAAA7VerLsOcLuBYXR7vZI2NjhTRERdeAiwZ9EeJWta3L_JZVS0bOBRIFbhTrQjhHE52fqjZvfabYYyn6A";
> $itemsFeedURL = "http://www.google.com/base/feeds/items";;
>
>                                 curl_setopt($ch, CURLOPT_URL,  
> 'http://www.google.com/base/feeds/
> items');
>                 curl_setopt($ch, CURLOPT_POST, true);
>                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);  //
> for debugging
> purpose
>                 curl_setopt($ch, CURLOPT_POSTFIELDS, $items_array);
>                 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
>                         'Authorization: AuthSub token='.$token.'\'',
>                         'X-Google-Key: key=$devkey',
>                         'Content-Type: application/atom+xml',
>                 ));
>                 $result = curl_exec($ch);
>                                 echo($result);
>                                 $er_msg=curl_error ($ch );
>                 echo $er_msg;
>
>                 curl_close($ch);
>
> ?>
> i got token invalid: invalid authsub token meesage
> Is authsub token and single use token are same or do i need to replace
> it with multi use token?
>
> Please tell me how to resolve this.
> Thanks,
> Sridevi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base 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-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to