
Mike Knoop
By: a guest on Jun 24th, 2009 | syntax:
None | size: 0.74 KB | hits: 399 | expires: Never
// Code to be placed into your facebookapi_php5_restlib.php file.
/**
* Returns an array of mutual friends between the source and target
*
* @param int $uid1 Source UID
* @param int $uid2 Target UID
*
* @return array An array of friends
*/
public function &friends_getMutualFriends($uid1=null, $uid2 = null) {
return $this->call_method('facebook.friends.getMutualFriends',
array('target_uid' => $uid1,
'source_uid' => $uid2));
}
// end
// Code to utilize the above call
$friends = $GLOBALS['Facebook']->api_client->friends_getMutualFriends('4', $_POST['fb_sig_user']);
$count = count($friends);
echo "You have $count friends in common.<br />";
print_r($friends);
// end