This article is a step-by-step PHP tutorial explaining how to use the Facebook PHP SDK to get the list of the online friends of the current user.
To get the list of online friends in PHP, first you need to authenticate users with their Facebook account asking for the permission
friends_online_presence. This is done using the Facebook PHP SDK (see on github) adding
friends_online_presence to the scope while generating the login link:
Then, if the user is logged in, you can make the request:
The results will be like:
Array(  => Array( [uid] => 1536397056 [name] => Quentin Pleplé [pic_square] => http://...jpg [online_presence] => active )  => ...  => ... ... )
online_presence property can take 4 values: