Hi - I am new to this Google API and am working on a project to access and update gMail contacts using PHP5 and cURL. I am able to update a contact using the cURL command line method documented here: http://code.google.com/apis/gdata/articles/using_cURL.html#updating-entries
So this example (substituting real values for the authorization key and edit url) works from the command line: -------------------------------------------------------------------------------------------------------------------------------------------------------------------- curl --data "@updated_entry.xml" --request PUT --header "Content-Type: application/atom+xml" --header "Authorization: GoogleLogin auth=ABCDEFG" "http://picasaweb.google.com/data/entry/api/user/ brad.gushue/albumid/9810315389720904593/123456" -------------------------------------------------------------------------------------------------------------------------------------------------------------------- When I try the same thing from within PHP I get an HTTP 400 / Bad Request error (premature end of file). Does anyone have an example of how to construct a contact update (either from a file or a string) using cURL from PHP? Here are the basics of what I am trying (using the values from the command line example above - the test code uses real values for the key and edit url): -------------------------------------------------------------------------------------------------------------------------------------------------------------------- $header_array[0]="Content-Type: application/atom+xml"; $header_array[1]="Authorization: GoogleLogin auth=ABCDEFG"; $fh = fopen("@updated_entry.xml" , 'r'); $ch = curl_init(); curl_setopt($ch, CURLOPT_PUT, TRUE); curl_setopt($ch, CURLOPT_INFILE, $fh); curl_setopt($ch, CURLOPT_INFILESIZE, filesize("@updated_entry.xml")); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER,$header_array); curl_setopt($ch, CURLOPT_URL, "http://picasaweb.google.com/data/entry/ api/user/brad.gushue/albumid/9810315389720904593/123456"); $contact_update_array['FILE'] = curl_exec($ch); curl_close($ch); fclose($fh); var_dump($contact_update_array); -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Any help or insights would be greatly appreciated! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
