0
votes

I'm trying to retrieve a list of documents from a folder named "myfolder" in Google Docs using Zend Framework.

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient("[email protected]", "password", $service);
$docs = new Zend_Gdata_Docs($client);
$feed = $docs->getDocumentListFeed('https://docs.google.com/feeds/documents/private/full/-/myfolder');
$this->view->feed = "";

foreach ($feed as $document) {
    $link = $document->getLink();
    $this->view->feed .= '<a href="'.$link[0]->getHref().'" target="_blank">'.$document->getTitle().'</a><br/>';
}

I was able to get a list of all files in "myfolder"; but when I try to open them, I get an error:

Authorization required

Error 401

I've tried using

https://docs.google.com/feeds/documents/private/full

instead of

https://docs.google.com/feeds/documents/private/full/-/myfolder

and I'm able to see all my files. I can open those that are saved under the "Home" directory without any problem. The Error 401 only happens when I try to open files that are saved in a folder.

Why? Any idea?

1
I'm answering my own questions... I should have used $link[1]->getHref() instead of $link[0]->getHref() because the file is one level away from the root. - woran

1 Answers

0
votes

Should have used $link[1]->getHref() instead of $link[0]->getHref().