Facebook: Get a list of online friends using the Graph api


I want to get a list of users online without Facebook SDK My fql Query looks like this

 $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 URl schedule

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 returns null data.

{
   "data": [

   ]
}

      

Note: my token has the friends_online_presence permission. I have 40 users on the internet.

+3


source to share


1 answer


online_presence

You need permissions user_online_presence

or to view friends_online_presence

. (see http://developers.facebook.com/docs/reference/fql/user )

Without these permissions, you will get online_presence

how null

and nothing will be filtered by this part WHERE

:online_presence IN ('active', 'idle')



If you remove this restriction from your request, you will see a list of friends with their statuses (or zeros if you do not have this permission)

+1


source







All Articles