我看到,我可以通过图形API访问朋友的群体:FQL朋友团体
https://graph.facebook.com/11111111/groups
...但我怎么通过FQL访问它? (I am在提出这些问题之前,请广泛地搜索文档,如果我问的是明显的问题,则很抱歉)。
我看到,我可以通过图形API访问朋友的群体:FQL朋友团体
https://graph.facebook.com/11111111/groups
...但我怎么通过FQL访问它? (I am在提出这些问题之前,请广泛地搜索文档,如果我问的是明显的问题,则很抱歉)。
,如果你想获得的用户组id为1111111
,你可以这样写查询:
select gid, name from group
where gid in (select gid from group_member where uid = 1111111)
不要忘记你需要有friends_groups权限才能得到这个数据
这些表的文档可以在这里找到:
http://developers.facebook.com/docs/reference/fql/group_member/
是的。我试过它不适用于FQL。但是你可以使用下面的代码通过图形API
function get_groups($facebook)
{
require_once 'config.php';
global $facebook;
$groups = $facebook->api('/me/groups');
var_dump($groups);
return $groups;
}
得到它的配置文件有以下几点:
<?php
require_once("facebook.php");
$app_id = "";//put the app id
$app_secret = "";//put app secret code inside " "
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
if(is_null($facebook->getUser()))
{
header("Location:{$facebook->getLoginUrl(array('req_perms' => 'user_status,publish_stream,user_photos'))}");//include the permission you want here
exit;
}
?>
我需要friends_groups权限从每个朋友,或者只是从自己?调用此FQL没有返回数据,即使我可以看到该用户的数据就在图形API的罚款: 选择GID从组 - 成员其中uid = 1111111 数据:[] https://graph.facebook.com/11111111/groups 数据:很多和很多 –
“*不要忘记,您需要拥有friends_groups权限才能获取此数据*”非常重要。 – DMCS
扩展权限仅由用户(对应用程序)授予。而不是他的朋友。 “friends_groups”表示用户授予应用程序访问其朋友组数据的权限 –