本文介绍了Facebook:使用Graph api获取在线好友列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想要在线获取用户名单,不需要Facebook SDK.My fql查询如下

  $ FQL =SELECT UID,名称,pic_square,online_presence 
从用户
其中online_presence IN( '活性', '空闲')
和UID IN(
选择UID2 FROM friend WHERE uid1 = $ user
);

我的图表URl是

  https://graph.facebook.com/fql?q=SELECT UID,名称,pic_square,online_presence FROM用户WHERE online_presence IN( '活性', '空闲')和UID IN(SELECT UID2 FROM朋友WHERE UID1 = 1234)及的access_token = xxxxxxtokenxxxxx&安培;方法= GET 

但是,上面的URL返回null数据。

  {
data:[

]
}

注意:我的令牌有friends_online_presence权限。我有40位用户在线。


'的div类= h2_lin>解决方案

您需要 user_online_presence friends_online_presence 权限查看 online_presence 。 (请参阅)



如果没有这些权限,您将收到 online_presence 作为 null ,这部分 WHERE 将不被任何内容过滤: online_presence IN('active','idle')



如果您从查询中删除此限制,您将看到具有状态的朋友列表(如果您没有此信息,则为null许可)



I want to Get list of users online without Facebook SDK.My fql Query is as below

 $fql = "SELECT uid, name, pic_square, online_presence
            FROM user
            WHERE online_presence IN ('active', 'idle')
            AND uid IN (
                SELECT uid2 FROM friend WHERE uid1 = $user
            )";

And my graph URl is

https://graph.facebook.com/fql?q=SELECT uid, name, pic_square, online_presence FROM user WHERE online_presence IN ('active', 'idle') AND uid IN (SELECT uid2 FROM friend WHERE uid1 = 1234)&access_token=xxxxxxtokenxxxxx&method=GET

But Above Url returning null data.

{
   "data": [

   ]
}

Note: my token have friends_online_presence permission .I have 40 users online.

解决方案

You need user_online_presence or friends_online_presence permissions to view online_presence. (see http://developers.facebook.com/docs/reference/fql/user)

Without these permissions you'll receive online_presence as null, and nothing will be filtered by this part of WHERE: online_presence IN ('active', 'idle')

If you'll remove this restriction from your query, you'll see the list of friends with their statuses (or nulls if you don't have this permission)

这篇关于Facebook:使用Graph api获取在线好友列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 19:46