I am using facebook php sdk v4 to post as admin to my own fan page. No other user will use this app.
The script will run under cron job and post three products a day. I created a new facebook app and use graph API explorer to get short live access token. I need extended permission on "manage_pages and "publish_actions". Tested using test app and working fine.
Now I need to get approval of the app. However, I do not use Facebook login and there is no call back url, which is required in the form of approval. Since this is run under background, Facebook team can not test the app.
How to get the actual app approved and run on my server?
$api_key = 'xxxxx';
$api_secret = 'yyyyy';
$page_id = 'zzzzz';
$accessToken='aaaaa';
FacebookSession::setDefaultApplication($api_key, $api_secret);
$session = new FacebookSession($accessToken);
$access_token = (new FacebookRequest( $session, 'GET', '/' . $page_id, array( 'fields' => 'access_token' ) ))
->execute()->getGraphObject()->asArray();
// save access token in variable for later use
$access_token = $access_token['access_token'];
$page_post = (new FacebookRequest( $session, 'POST', '/'. $page_id .'/feed', array(
'access_token' => $access_token,
'name' => 'product title',
'link' => 'product image url',
'caption' => 'web store name',
'message' => 'product description and url',
) ))->execute()->getGraphObject()->asArray();