Talk:Friends.get
From Facebook Developer Wiki
Someone needs to document on the article page how to organize the returns. Currently, friends.get will return the results by date added as a friend, in descending order.
- I would not count on this order as a Documented Feature... --1190307405 21:58, 3 May 2009 (PDT)
I need to see an example with this in PHP
- $friends = $facebook->api_client->friends_get(); --1190307405 21:58, 3 May 2009 (PDT)
How come you can only get the friends of the current logged in user? Is there any way or any chance of it being implimented that you can get a list of friends for any user?
- There is no way Facebook will let you scrape any user's friend list. It has to be a logged-in user, or a specific list you are checking against. See example of common friends below. --1190307405 21:58, 3 May 2009 (PDT)
Use FQL is you want to do order by operations.
[edit] Friends in common?
How come there's no way to get the list of friends in common between two users? One would think that would be public information, as it is in any user's page.
- You can, IF one of the users is the logged-in user of your app:
- //logged-in user's friends
- $user_friends = $facebook->api_client->friends_get();
- //common friends with $other_user
- $user_friends_fql = implode(',', $user_friends); //convert PHP array to comma-separated string
- $fql = "select uid2 from friend where uid1 = $other_user and uid2 in ($user_friends_fql)";
- $common_friends = $facebook->api_client->fql_query($fql);
--1190307405 21:58, 3 May 2009 (PDT)
- Also check out the function Friends.getMutualFriends
--6240430 12:43, 31 October 2009 (PDT)
