我用这个功能,当我从Facebook图形API的用户页喜欢。 前2个月前这个功能工作,从Facebook获得超过100个数据。 但现在这个功能得到比100页喜欢为每个用户只有更低。 Facebook的API有下一节,通常这个功能工作良好。 我怎样才能解决这个问题呢? 下面的代码的Facebook API的例子。 我需要去API的下一个页面,但我不能。
public function handle() {
$fb = new Facebook([
'app_id' => 'xxxxxx',
'app_secret' => 'xxxxxxx',
'default_graph_version' => 'v2.10',
]);
//$fb->setDefaultAccessToken($this->accessToken);
$likes = $fb->get("/$this->uid/likes?fields=id,name,fan_count,category,picture&limit=100000", $this->accessToken)->getGraphEdge();
$totalLikes = array();
if ($fb->next($likes)) {
$likesArray = $likes->asArray();
$totalLikes = array_merge($totalLikes, $likesArray);
while ($likes = $fb->next($likes)) {
$likesArray = $likes->asArray();
$totalLikes = array_merge($totalLikes, $likesArray);
}
} else {
$likesArray = $likes->asArray();
$totalLikes = array_merge($totalLikes, $likesArray);
}
if (Likes::where('facebook_id', '=', $this->uid)->exists()) {
//Session::put('facebookId', $uid);
} else {
foreach ($totalLikes as $totalLike) {
$pageLike = Likes::create();
$pageLike->facebook_id = $this->uid;
$pageLike->page_id = $totalLike['id'];
$pageLike->page_name = $totalLike['name'];
$pageLike->fan_count = $totalLike['fan_count'];
$pageLike->category = $totalLike['category'];
$pageLike->save();
}
//Session::put('facebookId', $uid);
}
} //function end -- //
{
"data": [
],
"paging": {
"cursors": {
"before": "MTUzNTIwNjI0NzQ5MzEy",
"after": "MzQ0NTkzNzU3Mjk5"
},
"next": ""
}
}