Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to manipulate Google Spreasheet in my application (in php), so, to do this, I want to use the google docs api with the zend gdata librairy.

I take this code in the zend sample docs but I get an error 500:

$_SESSION['docsSampleSessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
$client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['docsSampleSessionToken']);
$gdClient = new Zend_Gdata_Spreadsheets($client);
$feed = $gdClient->getSpreadsheetFeed();
$currKey = explode('/', $feed->entries[0]->id->text);
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($currKey);
$feed = $gdClient->getWorksheetFeed($query);

When I remove this line, all work fine:

$feed = $gdClient->getWorksheetFeed($query);

My error is "wrong scope" and my scope during the authentification is http://spreadsheets.google.com/feeds/spreadsheets/ (like the sample).

How to resolve this error ?

share|improve this question

1 Answer

up vote 1 down vote accepted

I found my error and I found an error in Zend librairy 1.11 when you want to update a cell.

So my first error is I put this scope:

http://spreadsheets.google.com/feeds/spreadsheets/

And the good scope is:

http://spreadsheets.google.com/feeds/

And the update error cell is that Zend send a PUT request http in https protocol when you work in unsecure scope, so Google doesn't want this.

For my test (it's not a good solution but for a test, it's ok ^^), I add this line in the file Zend/Gdata/App.php in the put function:

$requestData['url'] = str_replace('https', 'http', $requestData['url']);

And it's work :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.