List Contacts from a group from Zend GData-Collection of common programming errors

and thanks for reading.

My problem is that I’m trying to get a list of contacts belonging to a group in GData using Zend_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.

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

    xxxxxxxxxxxxxx = group ID

  2. 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 🙁

Originally posted 2013-11-09 23:13:06.