Search code examples
phpzend-frameworkgdatagoogle-docs-apigoogle-drive-api

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


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)


Solution

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