Я пытаюсь получить все отзывы со страницы Facebook. Но по некоторым причинам, он не получает все отзывы.
Код php:
$f1=$fb->get('/me/accounts?access_token='.$user_access_token);
$id = $f1->getDecodedBody()['data'][0]['id'];
$access_token = $f1->getDecodedBody()['data'][0]['access_token'];
$ff1=$fb->get('/'.$id.'/ratings?access_token='.$access_token);
$facebook_array = $ff1->getDecodedBody()['data'];
$review = array();
foreach($facebook_array as $data) {
$review_text="";
$pic= $fb->get('/'.$data["reviewer"]["id"].'/picture?access_token='.$access_token)->getHeaders()['Location'];
if(isset($data['review_text'])){
$review_text = $data['review_text'];
}
$r = array("profile_photo_url"=>$pic,
"created_time"=>$data['created_time'],
"rating"=>$data['rating'],
"reviewer"=>array("name"=>$data['reviewer']['name'],
"id"=>$data['reviewer']['id']),
"review_text"=>$review_text);
array_push($review,$r);
}
Просто добавьте параметр limit.
? Предел = 9999
$f1=$fb->get('/me/accounts?access_token='.$user_access_token);
$id = $f1->getDecodedBody()['data'][0]['id'];
$access_token = $f1->getDecodedBody()['data'][0]['access_token'];
$ff1=$fb->get('/'.$id.'/ratings?limit=100&access_token='.$access_token);
$facebook_array = $ff1->getDecodedBody()['data'];
$review = array();
foreach($facebook_array as $data) {
$review_text="";
$pic= $fb->get('/'.$data["reviewer"]["id"].'/picture?access_token='.$access_token)->getHeaders()['Location'];
if(isset($data['review_text'])){
$review_text = $data['review_text'];
}
$r = array("profile_photo_url"=>$pic,
"created_time"=>$data['created_time'],
"rating"=>$data['rating'],
"reviewer"=>array("name"=>$data['reviewer']['name'],
"id"=>$data['reviewer']['id']),
"review_text"=>$review_text);
array_push($review,$r);
}
Других решений пока нет …