Facebook api: counting visitors for an event (limit problem)

Ok, I am good at facebook API, but I have a problem that just makes me think. (I think this is a mistake (Check ticket http://bugs.developers.facebook.net/show_bug.cgi?id=13694 ), but I wanted to drop it here if anyone has an idea).

I use facebook PHP library to count all participants for a specific event

$attending = $facebook->api('/'.$fbparams['eventId'].'/attending');

this works without problems, it correctly returns an array with all participants ...

Now the problem is:

There are about 18,000 participants in this tournament. Api-call returns the maximum number of 992 participants (and not 18000, as it should).

I tried

$attending = $facebook->api('/'.$fbparams['eventId'].'/attending?limit=20000');

for testing, but doesn’t change anything.

So my real question is:

, api, ? ( , HTML- ?) , .

+3
3

: limit offset. , , . .

- , ( ):

offset = 0;
maxLimit = 992;
totalAttendees = count(result)

if (totalAttendees >= maxLimit)
{
  // do your stuff with each attendee
  offset += totalAttendees;
  // make a new call with the updated offset
  // and check again
}
+2

, : URL : this.

, , :

function events_get_facebook_data($event_id) {
  if (!$event_id) {
    return false;
  }

  $token = klicango_friends_facebook_token();
  if ($token) {
    $parameters['access_token'] = $token;
    $parameters['fields']= 'attending_count,invited_count';
    $graph_url = url('https://graph.facebook.com/v2.2/' . $event_id , array('absolute' => TRUE, 'query' => $parameters));
    $graph_result = drupal_http_request($graph_url, array(), 'GET');
    if(is_object($graph_result) && !empty($graph_result->data)) {
      $data = json_decode($graph_result->data);
      $going = $data->attending_count;
      $invited = $data->invited_count;
      return array('going' => $going, 'invited' => $invited);
    }
    return false;
  }

  return false;
}
Hide result
+1

Try

SELECT eid, attending_count, unsure_count, all_members_count FROM event WHERE eid = "event"

0
source

All Articles