问题
I'm trying to do this following the API documentation there: https://developers.google.com/google-apps/documents-list/#adding_a_resource_to_a_collection
With the Zend PHP gdata Framework my code is :
$docs->insertDocument($entryFile, 'https://docs.google.com/feeds/default/private/full/folder%3A0B--Zn-zouTFrOXdrV3lRelhuNHM/contents');
Documentation on this method
I don't know how to find the correct URI then...
The entryFile parameter is the right type, it's the url that cause the problem the error
Response from the server :
HTTP/1.1 400 Bad Request Content-type: text/html; charset=UTF-8 Date: Wed, 25 Apr 2012 17:10:51 GMT Expires: Wed, 25 Apr 2012 17:10:51 GMT Cache-control: private, max-age=0 X-content-type-options: nosniff X-frame-options: SAMEORIGIN X-xss-protection: 1; mode=block Server: GSE Connection: close Invalid request URI
The exception :
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 Invalid request URI' in C:\Program Files (x86)\EasyPHP-5.3.6.1\www\workspace\library\Zend\Gdata\App.php:709 Stack trace: #0 C:\Program Files (x86)\EasyPHP-5.3.6.1\www\workspace\library\Zend\Gdata.php(219): Zend_Gdata_App->performHttpRequest('POST', 'https://docs.go...', Array, 'performHttpRequest('POST', 'https://docs.go...', Array, 'post(Object(Zend_Gdata_Docs_DocumentListEntry), 'https://docs.go...', NULL, NULL, Array) #3 C:\Program Files (x86)\EasyPHP-5.3.6.1\www\workspace\library\Zend\Gdata\Docs.php(300): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_Docs_DocumentListEntry), 'https://docs.go...', 'Zend_Gdata_Docs.. in C:\Program Files (x86)\EasyPHP-5.3.6.1\www\workspace\library\Zend\Gdata\App.php on line 709
(If you need any info please let me know, i'm really stuck on this and i'm willing to give as much details as possible if needed)
回答1:
Could you please log the exact HTTP request that is performed by Zend and compare it ti the one listed in the documentation: https://developers.google.com/google-apps/documents-list/#adding_a_resource_to_a_collection
I'm sure the differences will show you what is done wrong.
回答2:
I solved the problem using the Php Client Library for the Google Drive SDK
来源:https://stackoverflow.com/questions/10320384/google-docs-api-adding-a-ressource-to-a-collection-zend-gdata