php zend gdata - Get list of google docs using oau

2019-02-07 14:56发布

I've got my session with the valid token that i set up this way :

$session_token = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
// Store the session token in our session.
$_SESSION['cal_token'] = $session_token;

Then i want to be able to do this:

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$docs = new Zend_Gdata_Docs($client);
$feed = $docs->getDocumentListFeed();

But using the token. Instead of the authentication with user/pass/service

I already looked at some example of this but i didn't find any way to make it work.

Thank you everyone!

1条回答
何必那么认真
2楼-- · 2019-02-07 15:26
    // Retrieve user's list of Google Docs
    $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['cal_token']);
    $docs = new Zend_Gdata_Docs($client);
    $feed = $docs->getDocumentListFeed();
    foreach ($feed->entries as $entry) {
      echo "$entry->title\n";
    }
查看更多
登录 后发表回答