开发者

List Contacts from a group from Zend GData

and thanks for reading.

My problem is that I'm trying to get a list of contacts belonging to a group in GData using Zen开发者_开发问答d_Gdata_Query.

Using

$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full/?group=http://www.google.com/m8/feeds/groups/xxx...xxx/base/XXX');
$feed = $gdata->getFeed($query);

give me an "Unknown authorization header".

$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full/');
$query->setParam('group', 'http://www.google.com/m8/feeds/groups/XXX...XXX/base/XXX');
$feed = $gdata->getFeed($query);

is the same.

Obviously without that parameter I get all the contacts.

I already tried the first method with the parameter in the URL with a modified Extension to CakePHP core HttpSocket and it was working. So I suppose the problem is with Zend stripping out parameters from the url but I had no luck looking at the libraries.

Thanks for any help.


$query->setParam('group', 'http://www.google.com/m8/feeds/groups/myemail%40gmail.com/base/xxxxxxxxxxxxxx');

xxxxxxxxxxxxxx = group ID


As above the max-results also works if you add it to the query string like so: http://www.google.com/m8/feeds/contacts/default/full?max-results=1000

Note that even in the google documentation the only way of getting ALL results is by 'setting a high number' for the number of results returned. So you can never explicitly specify 'ALL'


I guess you are using 3-legged OAuth. Then you need to add next line before getFeed() called: $gdata->getHttpClient()->setRequestScheme(Zend_Oauth::REQUEST_SCHEME_QUERYSTRING); It will solve "Unknown authorization header" error.

For me using $query->setParam('group', 'http://www.google.com/m8/feeds/groups/XXX...XXX/base/XXX'); returns another error: "Invalid value for group parameter: XXXXXXXXXX" and I still dunno how to fix it :(

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜