FacebookRestClient::groups_get PHP Method

groups_get() public method

Returns groups according to the filters specified.
public groups_get ( integer $uid, array $gids ) : array
$uid integer Optional: User associated with groups. A null parameter will default to the session user.
$gids array Optional: group ids to query. A null parameter will get all groups for the user.
return array of groups
    public function groups_get($uid, $gids)
    {
        return $this->call_method('facebook.groups.get', array('uid' => $uid, 'gids' => $gids));
    }

Usage Example

    }
    // 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']);
        $event_count = count($event_members['attending']);
    }
    // Get all photos of the user, trim to 10.
    $photos = array_slice($client->photos_get($uid, null, null), 0, 10);
    // Get all notifications for the current user.
    $notifications = $client->notifications_get();
    // Get the user's groups, and save a few
    $groups = array_slice($client->groups_get($uid, null), 0, 5);
} catch (FacebookRestClientException $ex) {
    if (!isset($uid) && $ex->getCode() == 100) {
        // This will happen if auth_getSession fails, which generally means you
        // just hit "reload" on the page with an already-used up auth_token
        // parameter.	Bounce back to facebook to get a fresh auth_token.
        header('Location: ' . $config['login_url']);
        exit;
    } else {
        // Developers should probably handle other exceptions in a better way than this.
        throw $ex;
    }
}
?>
<html><head><title>Example PHP5 REST Client</title></head>
<body>