列出 Zend GData 组中的联系人
感谢您的阅读。
我的问题是我正在尝试使用 Zend_Gdata_Query 获取属于 GData 中某个组的联系人列表。
使用
$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);
给我一个“未知的授权标头”。
$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);
是一样的。
显然,如果没有该参数,我就可以获得所有联系人。
我已经尝试使用 URL 中的参数和对 CakePHP 核心 HttpSocket 的修改扩展的第一种方法,并且它正在工作。所以我想问题出在 Zend 从 url 中删除参数,但我没有运气查看这些库。
感谢您的任何帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
xxxxxxxxxxxxxxx = 组 ID
xxxxxxxxxxxxxx = group ID
如上所述,如果将最大结果添加到查询字符串中,则它也会起作用,如下所示:
http://www.google.com/m8/feeds /contacts/default/full?max-results=1000
请注意,即使在 Google 文档中,获取所有结果的唯一方法也是为返回的结果数“设置一个较高的数字”。所以你永远不能明确指定“ALL”
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'
我猜你正在使用 3 足 OAuth。然后您需要在调用 getFeed() 之前添加下一行:
$gdata->getHttpClient()->setRequestScheme(Zend_Oauth::REQUEST_SCHEME_QUERYSTRING);
它将解决“未知授权标头”错误。
对我来说使用
$query->setParam('group', ' http://www.google.com/m8/feeds/groups/XXX...XXX/base/XXX');
返回另一个错误:“组参数值无效:XXXXXXXXXXXX”,我仍然不知道如何修复它:(
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 :(