I've got problems with posting from PHP on Facebook PAGE wall. Same code posts for my personal account (admin on that Facebook page) - but without success when i trying to post on Page.
code working to post on user wall $linkData = [ 'link' => 'http://www.somewebpagelink.com', 'message' => 'User provided message', 'description' => 'test', 'caption' => 'caption', 'published' => 'true' ];
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post('me/feed', $linkData, $accessToken);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
echo 'Posted with id: ' . $graphNode['id'];
But when i've change
$response = $fb->post('https://graph.facebook.com/{valid_page_id}/feed', $linkData, $accessToken);
Where valid_page_id is my real page id, it doesn't post on Facebook page.
Can someone help ?
Ps. Defined app is public, user i've used as login had admin privileges to this page.
Thanks!