After updating there is an empty file

I am trying to update an existing document using the Google Docs API. I am using PHP + Curl. gdata.class.php is the base class. The update is partially completed. Old content is cleared. But new content is not created. According to the documentation, I send a PUT request (initial request) to the address

 http://docs.google.com/feeds/upload/create-session/default/private/full/document%123456 

There is an etag document and an empty request body. I get a 200 Ok status code and a unique URI to load as follows:

 http://docs.google.com/feeds/upload/create-session/default/private/full/document%123456?upload_id=EnB2Uob7DWcFVJTX3oF8sdVv9koZTHacngmM_ 

What should I do???

  • I send the contents of the file and headers to a unique URI for download:

     [0] => Content-Length: 6 [1] => Content-Range: bytes 0-5/6 [2] => Content-Type: text / plain 

    Answer received:

    HTTP / 1.1 308 Summary Incomplete

    The headers do not contain the "Range" header. This is strange. Result : the target file does not change.

  • I send the contents of the file and headers to a unique URI for download:

     [0] => Content-Length: 6 [1] => Content-Type: text/plain 

    Answer received:

     HTTP/1.1 200 OK 

    There is an atom + xml in the body. Result : the target file has become empty.

Ps The curl_getinfo function returns "5" . It does not depend on file size.

+4
source share
1 answer

Well, if he asks you to use the PUT method, then say CURL to use it.

 curl_setopt($ch, CURLOPT_PUT, 1); 
0
source

All Articles