Page 1 of 1

GData https request redirects to Google start page

Posted: Wed Oct 12, 2011 10:48 am
by lars_heuer
I made a Zend GData request using the following code (source: http://code.google.com)

Code: Select all

  $books = new Zend_Gdata_Books();
  $query = $books->newVolumeQuery();
  $query->setQuery('domino');
  $query->setMinViewability('partial_view');
  $feed = $books->getVolumeFeed($query);

  foreach ($feed as $entry) {
    echo $entry->getVolumeId();
    echo $entry->getTitle();
    echo $entry->getViewability();
  }
and I got an error message saying
DOMDocument cannot parse XML: Extra content at the end of the document in Entity, line: 1
I found out that my calls to books.google.com were redirected to the Google start page - the reason why the response could not be parsed as XML.
To my surprise I got it to work by switching from https to http. I had to edit the Zend_Gdata_Books class.
Zend/GData/Books.php, line 65:

Code: Select all

const VOLUME_FEED_URI = 'http://books.google.com/books/feeds/volumes';
instead of

Code: Select all

const VOLUME_FEED_URI = 'https://books.google.com/books/feeds/volumes';

Re: GData https request redirects to Google start page

Posted: Thu Feb 23, 2012 2:31 pm
by snorri67
Thanks for posting this issue. Had the same problem.
I worried why Gdata worked fine in a ZF 1.11.3 installation but not any more in ZF 1.11.11.
The reason is it still had a http link constant, in ZF 1.11.11 it's https ...