friends_areFriends() 공개 메소드

Note that the Facebook friend relationship is symmetric.
public friends_areFriends ( $uids1, $uids2 ) : array
리턴 array of uid pairs with bool, true if pair are friends, e.g. array( 0 => array('uid1' => id_1, 'uid2' => id_A, 'are_friends' => 1), 1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0) ...)
예제 #1
0
     * example.  */
    setcookie('session_key', $session_info['session_key'], $expires);
    setcookie('uid', $uid, $expires);
}
$my_profile = $client->users_getInfo(array($uid), $profile_field_array);
$my_name = $my_profile[$uid]['name'];
$friends_array = array_slice($client->friends_get(), 0, 5);
$coworkers_array = $client->friends_getTyped('WORKED');
$albums = $client->photos_getAlbums($uid);
$album_photos = $client->photos_getFromAlbum($albums[0]['aid'], $uid);
$friend_profiles = $client->users_getInfo($friends_array, $profile_field_array);
$events = $client->events_getInWindow(time(), time() + 86400 * 30);
$photos = $client->photos_getOfUser($uid, 5);
$messages = $client->messages_getCount();
$wall_count = $client->wall_getCount();
$are_friends = $client->friends_areFriends($friends_array[0], $friends_array[1]);
print "<html><head><title>Example PHP5 REST Client</title></head><body>";
print '<a href="sample_client.php?logout=1">logout</a>';
print "<h2>{$my_name}'s info </h2>";
print '<P>Total messages: ' . $messages['total'] . ', unread: ' . $messages['unread'];
print '<P>Wall posts: ' . $wall_count;
print '<p>Friend one and friend two are ' . ($are_friends[0] ? '' : 'not ') . 'friends.';
print_profiles($my_profile);
print "<h2>{$my_name}'s friends</h2>";
print "<HR>";
print_profiles($friend_profiles);
print "<p><h2>Your upcoming events </h2><P>";
if (is_array($events)) {
    foreach ($events as $id => $event) {
        print "<hr>";
        print "<P>Event " . $event['name'];
try {
    // Create our client object.
    // This is a container for all of our static information.
    $client = new FacebookRestClient($config['rest_server_addr'], $config['api_key'], $config['secret'], null, false);
    // The required call: Establish session
    // The session key is saved in the client lib for the whole PHP instance.
    $session_info = $client->auth_getSession($auth_token);
    $uid = $session_info['uid'];
    // Get the entire user profile.
    $user_profile = $client->users_getInfo($uid, $profile_field_array);
    $user_name = $user_profile[0]['name'];
    // Get five of the user's friends.
    $friends_array = array_slice($client->friends_get(), 0, 5);
    // See if these two friends know each other.
    if (isset($friends_array[0]) && isset($friends_array[1])) {
        $friend_info = $client->friends_areFriends($friends_array[0], $friends_array[1]);
    }
    // Get all of this user's photo albums.
    $albums = $client->photos_getAlbums($uid, null);
    if (!empty($albums)) {
        $album = $albums[0];
        // Get all photos from this album.
        $album_photos = $client->photos_get(null, $album['aid'], null);
    }
    // Get the profiles of users' five friends.
    $friend_profiles = $client->users_getInfo($friends_array, $profile_field_array);
    // Get events for the next few weeks.
    $events = $client->events_get($uid, null, time(), time() + 86400 * 21, null);
    if (isset($events[0])) {
        $first_event_eid = $events[0]['eid'];
        $event_members = $client->events_getMembers($events[0]['eid']);