Get Friends Who Use My App
Problem
I need to retrieve all of the current loggedinuser
’s friends who already have my
app installed.
Solution
Use the Friends.getAppUsers()
method:
$friends = $facebook->api_client->friends_getAppUsers();
This method has no parameters, and it can be called only for the
combination of the current loggedinuser
and your application.
Discussion
Friends.getAppUsers()
returns an array of uid
s of the
friends who have your app installed. It is against the terms of use of
Facebook Platform to store the returned values from this call.
FQL equivalent
If you’d prefer to use FQL to access friends, the equivalent query is:
SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=$uid) AND is_app_user
See App Friends for more information.
Get Facebook Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.