【问题标题】:FQL Friend's groupsFQL 朋友的群组
【发布时间】:2012-01-20 01:33:16
【问题描述】:

我发现我可以通过 Graph API 访问朋友的群组:

https://graph.facebook.com/11111111/groups

...但是如何通过 FQL 访问它? (在提出这些问题之前,我正在广泛搜索文档,抱歉,如果我问的是一个明显的问题。

【问题讨论】:

    标签: facebook-graph-api facebook-fql facebook-group


    【解决方案1】:

    如果您想获取 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/

    http://developers.facebook.com/docs/reference/fql/group/

    【讨论】:

    • 我需要每个朋友的friends_groups权限,还是只需要我自己的权限?调用此 FQL 不会返回任何数据,即使我可以在 Graph API 中很好地看到该用户的数据: select gid from group_member where uid = 1111111 Data:[] graph.facebook.com/11111111/groups Data: lot and lot
    • 别忘了你需要获得friends_groups权限才能获取这些数据”非常非常重要。
    • 扩展权限仅由用户(应用程序)授予。不是他的朋友。 “friends_groups”表示用户授予应用程序访问他的朋友组数据的权限
    • 感谢您的澄清。我确实授予了这些权限,但我仍然没有从这个调用中返回任何数据:select gid from group_member where uid = 1111111
    • 这也取决于您的朋友是否允许应用程序使用他的数据(此设置在朋友帐户的隐私菜单中)
    【解决方案2】:

    是的。我试过它不适用于 FQL 。但是你可以使用下面的代码通过graph 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;
        }
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多