Facebook online friend

2019-01-18 00:43发布

问题:

ive tryed some solution found here to get a list of my friend online:

Facebook FQL query to get all users online

How to get list of online friends using FQL with facebook API?

this is my fql query:

$fql = "SELECT uid, name, online_presence, status FROM user WHERE uid IN 
( SELECT uid2 FROM friend WHERE uid1 = '".$me['id']."')";

But the presence field is empty for 99% of my friends. I get the presence (active, idle, offline), only for 6/7 friends. the same for the status field.

How i can get the complete presence and status data? What i'm missing? I need to request a particular permission for my app (currently i have only the basic).

Thank you very much.

EDIT: The @Roozbeh15 solution is the answer, but i need to fid why the result isn't the same number of user i hvae in chat. The fql user count is always < than the user in fb chat. Do you know why?

回答1:

You need the user_status permission to read the user's status and user_online_presence and/or friends_online_presence permissions for the online_presence.

Here is the full permissions list.