Facebook graph api FQL好友组
我发现我可以通过Graph API访问朋友的群组:Facebook graph api FQL好友组,facebook-graph-api,facebook-fql,facebook-group,Facebook Graph Api,Facebook Fql,Facebook Group,我发现我可以通过Graph API访问朋友的群组: https://graph.facebook.com/11111111/groups 。。。但我如何通过FQL访问它?在问这些问题之前,我正在广泛搜索文档,如果我问的是一个明显的问题,很抱歉。如果您想获得id为1111111的用户组 您可以编写以下查询: select gid, name from group where gid in (select gid from group_member where uid = 11111
https://graph.facebook.com/11111111/groups
。。。但我如何通过FQL访问它?在问这些问题之前,我正在广泛搜索文档,如果我问的是一个明显的问题,很抱歉。如果您想获得id为1111111的用户组 您可以编写以下查询:
select gid, name from group
where gid in (select gid from group_member where uid = 1111111)
不要忘记,要获取此数据,您需要具有friends\u groups权限
这些表格的文档可在此处找到:
嗯。我试过,它与FQL不起作用。但是您可以使用下面的代码通过GraphAPI获得它
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;
}
?>
我需要每个朋友的好友组权限,还是只需要我自己的权限?调用此FQL不会返回任何数据,即使我可以在Graph API中很好地看到此用户的数据:select gid from group_member,其中uid=1111111 data:[]数据:lots和lots不要忘记,为了获取这些数据,您需要拥有friends\u groups权限。扩展权限仅由用户授予应用程序。不是他的朋友。friends_groups表示用户授予应用程序访问其朋友组数据的权限谢谢您的澄清。我确实被授予了这些权限,但我仍然没有从这次呼叫中返回任何数据:从group_member中选择gid,其中uid=1111111这还取决于您的朋友是否允许应用程序使用其数据此设置位于朋友帐户的隐私菜单中