So, I figured out how to get an access token from Google using the Zend_Oauth library in 1.10. Now lets say I want to get my contacts...
$config = array(
'consumerKey' => 'zzz',
'signatureMethod' => 'HMAC-SHA1',
'consumerSecret' => 'xxx'
);
$token = unserialize($_SESSION['GOOGLE_ACCESS_TOKEN']);
$client = $token->getHttpClient($config);
$client->setMethod(Zend_Http_Client::GET);
// $client->setParameterGet('max-results', '10000');
$gdata = new Zend_Gdata($client);
$gdata->setMajorProtocolVersion(3);
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full');
// $query->MaxResults=100;
$feed = $gdata->getFeed($query);
$feed
is a lovely object with 25 contacts. But if I want to get more in a single pull, there doesn't seem to be a way of specifying max results that works.
If I uncomment client->setParameterGet
it's ignored. It works if I specify $client->setUri
and use $rawdata = client->request()
to get the response, but then other issues crop up with handling the feed data that comes back... like getting it into GData for easy handling.
I've tried $feed = $gdata->importString($rawdata->getBody())
but while $rawdata->getBody()
returns what seems to be valid XML, $feed->totalResults
throws an error, while it wouldn't if I used $gdata->getFeed($query)
.
If I uncomment $query->MaxResults=100;
use $gdata->getFeed($query)
Google returns a 401 with "Unknown authorization header".
So is it possibly to specify parameters while using Zend_GData with an Oauth token? Or am I going to have to build my own requests, then use Zend_Feed (or some other XML/Feed dissector) for parsing?