Facebook Api最多只返回25个事件?
问题描述:
我正在测试我的新iframe应用程序,Facebook Api最多只返回25个事件?
尝试使用图形api获取用户的所有事件。
$tempevent = $facebook->api('/me/events', 'get', array("fields"=>"id, name, start_time"));
所以它只返回25个事件..最远的事件。
任何想法?
刚刚检出JS版本..相同的结果。
FB.api('/me/events', function(response) {
console.log("event id: " + response.data[0].id); //k
console.log("event id: " + response.data[24].id); //k
console.log("event id: " + response.data[25].id); //not k
});
答
使用FQL:
$tempevent = $this->facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT eid, name, start_time FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me())'
));
说明:
在这里,您是从event
表中获取的所有事件,其中事件ID(eid
)是IN
其中用户me()
链接到event_member
表,无论他是attending
,unsure
,declined
或not_replied
。
答
我电子书籍您尝试访问以下网址https://graph.facebook.com/me/events?access_token=YOUR_ACCESS_TOKEN
。向下滚动。你会看到Facebook返回分页结果。除了data
param(由sdk返回)之外,还有另外一个paging
param。这个包含更多结果的链接,称为next
和previous
。使用它们来检索更多事件。
此外,如果您想要每页检索更多事件,您可以在access_token之间添加limit
参数。例如:https://graph.facebook.com/me/events?access_token=YOUR_ACCESS_TOKEN&limit=50
。
祝你好运。
不明白它..如何在PHP中做到这一点? ('fields'=>“id,name,start_time”,'access_token'=> $ facebook-> getAccessToken(),'limit'=' > 50)); ?? – 2011-01-23 22:09:08
你可以通过直接抓取那个url来做到这一点,比如`json_decode(file_get_contents(url))`。但使用ifaour建议,我只是告诉你,Facebook给你所有的事件,但分页,当使用图表api – misterjinx 2011-01-24 07:36:02