facebook php,你如何使用结果分页? [英] facebook php, how do you use results paging?
问题描述
你好,我正在使用Facebook PHP SDK(v.3.1.1)
Hello i am using the Facebook PHP SDK (v.3.1.1)
我不明白如何使用结果分页网址。
I don't understand how to use the results paging url.
我想得到所有朋友的列表,这里是我的代码
I want to get a list of ALL my friends, here is my code
$friends = $fb->api('/me/friends');
/*
$friend == Array
(
[data] => Array
(
...
),
[paging] => Array
(
[next] => https://graph.facebook.com/me/friends?method=GET&access_token=SOMETHING&limit=5000&offset=5000
)
*/
if (!empty($friends['paging']['next']))
{
$friends2 = $fb->api($friends['paging']['next']);
//doesn't work
}
推荐答案
您得到的分页结果中的值是您需要请求的实际网址,以获得下一个组的结果,例如:
The values in the paging results that you get are the actual URL's that you need to request in order to get the next group of results. For example :
...
{
"name": "Adobe Flash",
"category": "Software",
"id": "14043570633",
"created_time": "2008-06-05T17:12:36+0000"
}
],
"paging": {
"next" :https://graph.facebook.com/{USER_ID}/likes?format=json&limit=5000&offset=5000
}
这是下一步当我向我的用户查询我喜欢的页面时得到。如果我要求这个URL,那么它会给我5000个喜欢的偏移量为5000(因为我已经在初始请求中已经有第5000个)。
希望这澄清事情!祝你好运!
This is the "next" paging result I get when I query my user for the pages I like. If I request this URL it will give me a total of 5000 likes with an offset of 5000 (because I already have sen the first 5000 in the initial request). Hope this clarifies things! good luck!
这篇关于facebook php,你如何使用结果分页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!