Facebook : Get List of Online Friends Using Graph api

萝らか妹 提交于 2019-12-22 11:18:40

问题



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.


回答1:


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)



来源:https://stackoverflow.com/questions/14937727/facebook-get-list-of-online-friends-using-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!