我尝试了很多最终成功获得总帖子。
try {
$post_request=$fb->get("/{$page_id}/posts");
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo $e->getMessage();
exit;
}
$total_post=array();
$post_response=$post_request->getGraphEdge();
$response_array=$post_response->asArray();
$total_post=array_merge($total_post,$response_array);
if($fb->next($post_response)){
while($post_request=$fb->next($post_response)){
$post_response=$post_request;
$response_array=$post_response->asArray();
$total_post=array_merge($total_post,$response_array);
}
//echo "<pre>"; print_r($total_post);
}
else {
$total_post=$post_request->getGraphEdge()->asArray();
// print_r($total_post);
}
$page_post_total= count($total_post);
保存页面喜欢的用户数量的字段是'fan_count'。 https://developers.facebook.com/docs/graph-api/reference/page/ – CBroe
我怎样才能获得我的网页的总评价,评论,分享和帖子? –
请阅读文档,它会告诉您哪些字段和边缘可用。 – CBroe