Да, теперь я наконец получил свой собственный ответ. Как @ We0 comment, я пытаюсь получить своих общих друзей, и я пытаюсь получить список участников мероприятия, используя event_id
. И я сливаюсь с функцией array_search
. И следующий мой код ...
function getCommonFriend($event_id)
{
//Setup Facebook Configuration
$facebook = new Facebook(Config::get('facebook'));
//If there is no common friends so there will be 0
$commmon_friends = 0;
//Get Attending Friends
$event_attending = $facebook->api('v2.1/' .$event_id . '?fields=attending');
$event_attending_friends = $event_attending['attending']['data'];
$events_attending_friends_id = array();
foreach ($event_attending_friends as $key => $value) {
$events_attending_friends_id['id']{$key} = $value['id'];
}
//Get Own Mutual Friends
$me = $facebook->api('v2.1/me?fields=context');
$my_mutual_friends = $me['context']['mutual_friends']['data'];
foreach ($my_mutual_friends as $key => $value) {
$my_mutual_friends_id = $value['id'];
$get_commmon_friends = array_search($my_mutual_friends_id, $events_attending_friends_id['id']);
if (!empty($get_commmon_friends)) {
$commmon_friends ++;
}
}
return $commmon_friends;
}
Получить друзей и сравнить их с людьми, посещающими? – We0