Hello I created an API to post directly, it works very well on my facebook profile, the status is ok when I try to publish a status in my page, the post goes in the visitors publications what do I do ?
I looked in the Facebook Graph API, it would seem that this is a bug .. that you can bypass with using Curl..?
ps/ I edited the information page id, app id, secret app
Thanks in advance for your help
Stéphanie
public function statutPage(){
$fb = new Facebook([
'app_id' => 'my app id',
'app_secret' => 'my app secret',
'default_graph_version' => 'v2.8',
]);
$pageID='my page id,;
$token='A_VALID_USER_ACCESS_TOKEN';
$attachment = [
'access_token' => $token,
'message' => 'Premier message auto',
'name' => 'Première publication sur facebook',
'caption' => 'Legend sous le tire',
'link' => 'https://www.la-programmation.surleweb-france.fr',
'description' => 'Description du lien',
'picture' => 'https://www.google.fr/images/srpr/logo11w.png'
];
try {
$response = $fb->post('/'.$pageID.'/feed/', $attachment);
} catch(FacebookAuthorizationException $e) {
echo 'Graph retourne une erreur: ' . $e->getMessage();
exit;
} catch(FacebookSDKException $e) {
echo 'Facebook SDK retourne une erreur: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
echo 'Posté su Facebook avec l\'id: ' . $graphNode['id'];
}