FacebookRestClient::notifications_get PHP Method

notifications_get() public method

Returns the outstanding notifications for the session user.
public notifications_get ( ) : assoc
return assoc array of notification count objects for 'messages', 'pokes' and 'shares', a uid list of 'friend_requests', a gid list of 'group_invites', and an eid list of 'event_invites'
    public function notifications_get()
    {
        return $this->call_method('facebook.notifications.get', array());
    }

Usage Example

        // 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']);
        $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;
    }
}
?>