views:

227

answers:

1

Is there a function in the Facebook.php library for getting friends of the user using a certain application. Something like:

$friends = $facebook->api('me/friends?access_token=' . $access_token);

But instead of listing all friends, it just lists friends using the same application.

+1  A: 

You should be able to do this with FQL:

select uid, name, is_app_user from user where uid in (select uid2 from friend where uid1=me()) and is_app_user=1
serg
Which function in the library to I pass the query to?
diggersworld
Like this?$fql_query = array( 'method' => 'fql.query', 'query' => 'select uid, name, is_app_user from user where uid in (select uid2 from friend where uid1=me()) and is_app_user=1' ); $fql_info = $facebook->api($fql_query);
diggersworld
@diggersworld Yes something like that. It doesn't work?
serg
@serg: No I get this error: Uncaught Exception: 104: Requires valid signature thrown in /mysite.com/src/facebook.php on line 413
diggersworld
@diggersworld Are you passing access_token somewhere? Try to add it as a parameter to that array maybe. Sorry I am not very familiar with PHP API.
serg
I tried tinkering with the code but had no luck... So instead of using the library I'm doing it manually. Basically getting all the users friends from facebook, and then matching them with what's in my database system.
diggersworld