1
votes

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)

2
Is there any way to have the complete URI logged? I suspect that the URI is being encoded twice, i.e. it should contain a : character, not a %3A encoded character.Ali Afshar
Thanks for the hint I will give a look at the framework to see that ;)Jerome Ansia
Not it's not that i try to replace it with the ":" but it's not working when i do an echo in the method performHttpRequest() the url doesn't seems to be encoded because it's still look like this URL:docs.google.com/feeds/default/private/full/…Jerome Ansia

2 Answers

0
votes

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.

0
votes

I solved the problem using the Php Client Library for the Google Drive SDK