I use this function when I get user page likes from Facebook Graph API. Before 2 months ago this function is working and get more than 100 data from Facebook. but now this function get only lower than 100 page likes for every user . Facebook API has a next section and normally this function is working good. How can I resolve this problem? Facebook API example below the code. I need to go next page of the api but I can't.
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": ""
}
}