Reputation: 427
I've created a Facebook App using the latest version of the PHP SDK (version 5) which publishes posts to my Facebook page when ran.
This is working...however the posts are going onto the page as 'private', so only I can see the posts when logged in to my personal Facebook page. the public cannot see them.
Does anyone know why this may be? Am I right in assuming I need to 'submit the App to Facebook for review' before it can send public posts to my page?
Here's my code below:
define('FACEBOOK_SDK_V4_SRC_DIR', __DIR__.'/src/facebook-sdk-v5/');
require_once(__DIR__.'/src/facebook-sdk-v5/autoload.php');
//Set your Facebook API settings
$fb = new Facebook\Facebook([
'app_id' => 'apptoken',
'app_secret' => 'appsecrettoken',
'default_graph_version' => 'v2.2',
]);
//Post property to Facebook
$linkData = [
'link' => 'http://www.google.co.uk',
'message' => 'Test message'
];
try {
$response = $fb->post('/me/feed', $linkData, 'thepageaccesstokenhere');
} 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();
Upvotes: 4
Views: 2754
Reputation: 5357
Go to managing your apps: https://developers.facebook.com/apps/
And make sure your app is in Live mode
Upvotes: 0
Reputation: 5338
One solution is to make the app public.
By default, I believe it's in development mode.
To do this, please follow below steps:
1. Go to https://developers.facebook.com
2. From the left sidebar, select "App Review"
3. Set "Make your app public?" to "Yes"
Page post made by your app should be available even if you're not logged in.
Upvotes: 2
Reputation: 447
You are Facebook app & page admin. That's why you are able to post as page, but it's for test purposes only so hidden from other users. You have to apply for permission (post_as_page) to achieve this.
Upvotes: 0