FacebookRestClient::events_get PHP Method

events_get() public method

Returns events according to the filters specified.
public events_get ( integer $uid, array $eids, integer $start_time, integer $end_time, string $rsvp_status ) : array
$uid integer Optional: User associated with events. A null parameter will default to the session user.
$eids array Optional: Filter by these event ids. A null parameter will get all events for the user.
$start_time integer Optional: Filter with this UTC as lower bound. A null or zero parameter indicates no lower bound.
$end_time integer Optional: Filter with this UTC as upper bound. A null or zero parameter indicates no upper bound.
$rsvp_status string Optional: Only show events where the given uid has this rsvp status. This only works if you have specified a value for $uid. Values are as in events.getMembers. Null indicates to ignore rsvp status when filtering.
return array of events
    public function events_get($uid, $eids, $start_time, $end_time, $rsvp_status)
    {
        return $this->call_method('facebook.events.get', array('uid' => $uid, 'eids' => $eids, 'start_time' => $start_time, 'end_time' => $end_time, 'rsvp_status' => $rsvp_status));
    }

Usage Example

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