我想在没有 Facebook SDK 的情况下获取在线用户列表。我的 fql 查询如下
$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
)";
我的图表 URl 是
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
但上述网址返回空数据。
{
"data": [
]
}
注意:我的 token 具有friends_online_presence权限。我有40个在线用户。
最佳答案
您需要 user_online_presence
或 friends_online_presence
权限才能查看 online_presence
。 (参见http://developers.facebook.com/docs/reference/fql/user)
如果没有这些权限,您将收到 online_presence
作为 null
,并且 WHERE
的这一部分不会过滤任何内容:online_presence IN('事件','空闲')
如果您从查询中删除此限制,您将看到好友列表及其状态(如果您没有此权限,则显示空值)
关于 Facebook : Get List of Online Friends Using Graph api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14937727/