开发者

PHP: Zend: Wrong scope and Google API spreadsheet

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->getSpreadsheetFee开发者_StackOverflow社区d();
$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 ?


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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜