Get the friends perform of the existing logged in user.FQL: select uid1 from friend wherein uid2="MY_USER_ID" and uid1 IN (SELECT uid1 native friend where uid2=me())Graph API: $facebook->api("/me/friends?format=json&limit=5000")
For each among the uid"s in the list, i can get the perform of common friends and count it.FQL: choose uid1 native friend wherein uid2="OTHER_USER" and uid1 IN (SELECT uid1 indigenous friend whereby uid2=me())Graph API: $facebook->api("me/mutualfriends/OTHER_USER")
HOWEVER, the takes TONS the time to operation this v all mine friends...Are you familiar with a far better way to perform that?
If your goal is only to acquire a list of friends v highest variety of mutual friends, i.e., you perform not care who those common friends are, then actually Geoff"s FQL call provided way too much details then friend need.
You are watching: Who do i have the most mutual friends with on facebook
I also notice that Geoff"s FQL return so lot data and Facebook actually truncates the data.
Besides, you can want to get the names of those girlfriend in the same FQl call...
An alternative FQL the looks better is this:
SELECT name,mutual_friend_count indigenous user wherein uid IN(SELECT uid2 indigenous friend where uid1=me())This return you the number of mutual girlfriend from her friend list. So if you have actually 500 friends, you will only get a an answer with 500 objects.
Taking Geoff"s answer come the next step, right here is a complete solution in PHP.
First, here was Geoff"s FQL:
SELECT uid1, uid2 native friend whereby uid1 IN (SELECT uid2 native friend where uid1=me()) and also uid2 IN (SELECT uid2 native friend whereby uid1=me())And right here is the PHP code to retrieve the JSON and check i m sorry friend has actually the many mutual friends with you. (Make certain you change your access token in the URL.)
$mutualfriendcount) if ($mutualfriendcount > $mostmutualfriends_count) $mostmutualfriends_count = $mutualfriendcount; $mostmutualfriends_id = $friend; echo "ID $mostmutualfriends_id has actually the most variety of mutual friends through you: $mostmutualfriends_count."?>
I"ve used a query like this to get mutual friends:
SELECT uid1, uid2 indigenous friend whereby uid1 IN (SELECT uid2 indigenous friend where uid1=me()) and also uid2 IN (SELECT uid2 native friend whereby uid1=me())It returns every one of your friends" common friends quickly.
I to be not certain what exactly you want to acheive finally. However if girlfriend are in search of top friend in the list you can attain that by fetching feed and then deserve to rank friends according to variety of posts.
$fql="SELECT actor_id from stream whereby filter_key = "others" and also source_id = me() order BY actor_id border 3000";$param=array( "method" => "fql.query", "query" => $fql, "callback" => "" ); $fqlResult1 = $this->facebook->api($param); $top_frds=array(); foreach($fqlResult1 as $result1) $top_frds<>=$result1<"actor_id">; $new_array = array();foreach ($top_frds as $key => $value) if(isset($new_array<$value>)) $new_array<$value> += 1;else $new_array<$value> = 1;$top_frds=array();foreach($new_array as $tuid => $trate)$top_frds<>=array("uid"=>$tuid,"rate"=>$trate);
thanks for contributing an answer to stack Overflow!Please be sure to answer the question. Carry out details and share your research!
But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; ago them up with recommendations or personal experience.
See more: How Many Breaths Does A Person Take In A Lifetime ? Don'T Waste Your Breath
To find out more, view our tips on writing an excellent answers.
short article Your price Discard
Not the prize you're looking for? Browse other questions tagged on facebook facebook-graph-api facebook-fql fql.multiquery or questioning your own question.
site design / logo design © 2021 ridge Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.11.10.40696