Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

Mike Knoop

By: a guest on Jun 24th, 2009  |  syntax: None  |  size: 0.74 KB  |  hits: 399  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. // Code to be placed into your facebookapi_php5_restlib.php file.
  2.   /**
  3.    * Returns an array of mutual friends between the source and target
  4.    *
  5.    * @param int $uid1  Source UID
  6.    * @param int $uid2  Target UID
  7.    *
  8.    * @return array  An array of friends
  9.    */
  10.   public function &friends_getMutualFriends($uid1=null, $uid2 = null) {
  11.     return $this->call_method('facebook.friends.getMutualFriends',
  12.         array('target_uid' => $uid1,
  13.               'source_uid' => $uid2));
  14.  
  15.   }
  16. // end
  17.  
  18.  
  19. // Code to utilize the above call
  20. $friends = $GLOBALS['Facebook']->api_client->friends_getMutualFriends('4', $_POST['fb_sig_user']);
  21. $count = count($friends);
  22.  
  23. echo "You have $count friends in common.<br />";
  24. print_r($friends);
  25. // end