My code:
$fb = new Facebook\Facebook([
'app_id'=>$clientId,
'app_secret'=>$clientSecret,
'default_graph_version' => 'v2.9',
]);
$uid = 'my_uid';
try {
$response = $fb->get('/'.$uid.'/posts', $clientId.'|'.$clientSecret);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo $e->getMessage();
exit;
}
var_dump($response->getDecodedBody());
$uid
is ID of my own facebook page, there is have the posts.
App domain in the settings is localhost
, site URL http://localhost/FB
.
Output of var_dump:
object(stdClass)[10] public 'data' => array (size=0) empty