facebook api:计数参加者的事件(限制问题) [英] facebook api: count attendees for event (limit problem)

查看:110
本文介绍了facebook api:计数参加者的事件(限制问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,通常我对facebook API都很好,但是我有一个问题,只是让我想知道。 (我认为这是一个错误(检查机票 http://bugs.developers.facebook。 net / show_bug.cgi?id = 13694 ),但是如果有人有想法,我想把它扔到这里。)



我是Facebook的PHP图书馆计算特定活动的所有与会者

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

这个工作没有问题,它正确地返回一个与所有与会者的数组...



现在回答问题:



此活动现在有约18.000名与会者。
api通话返回最多992人(而不是18000)。



我尝试过

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

进行测试,但不会更改任何内容。



所以我的实际问题是:



如果我不能通过使用图形API获得它的工作,那将是一个很好的选择? (解析事件页面的HTML可能吗?)现在我每几个小时改变手中的价值,这是繁琐而不必要的。

解决方案

实际上有两个参数, limit 偏移。我认为你必须同时玩,并继续打电话,直到一个回报少于最大值。限制。



这样的东西,但是以递归的方式(我在写伪代码):

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

if(totalAttendees> = maxLimit)
{
//为每个参加者做你的东西
offset + totalAttendees;
//使用更新的偏移量
//新的调用
}


Okay normally I'm all fine about the facebook API but I'm having a problem which just keeps me wondering. (I think it's a bug (Check ticket http://bugs.developers.facebook.net/show_bug.cgi?id=13694) but I wanted to throw it here if somebody has an idea).

I'm usng the facebook PHP library to count all attendees for a specific event

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

this works without a problem it correctly returns an array with all attendees...

now heres the problem:

This event has about 18.000 attendees right now. The api call returns a max number of 992 attendees (and not 18000 as it should).

I tried

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

for testing but it doesn't change anything.

So my actual question is:

If I can't get it to work by using the graph api what would be a good alternative? (Parsing the html of the event page maybe?) Right now I'm changing the value by hand every few hours which is tedious and unnecessary.

解决方案

Actually there are two parameters, limit and offset. I think that you will have to play with both and continue making calls until one returns less than the max. limit.

Something like this, but in a recursive approach (I'm writting pseudo-code):

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
}

这篇关于facebook api:计数参加者的事件(限制问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆