Google Docs API Adding a ressource to a collection (Zend/gdata)

百般思念 提交于 2019-12-08 03:29:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!