Question: Facebook: auto post on wall of a Page

Question

Facebook: auto post on wall of a Page

Answers 0
Added at 2017-09-07 21:09
Tags
Question

Here is a problem that drives me crazy for weeks!

For more than a year, I published automatically my website's articles on my 2 facebook Pages, directly on the wall (the main stream?). It worked like a charm. However, since March, these publications have moved to Publication->Visitors Publication (sorry for the translation but my FB is in French) so they are almost invisible!

Do you know if there was a change in FB policy regarding publishing on pages?I know that I use an old PHP SDK (3.1.1) but I can't update because of my server that doesn't have PHP 5.6! However I thing if it's a SDK version issue so the publish would be simply impossible...

Technically, a cron task on my webserver send the request with my FB App id and secret code, and use my personnal access token to publish. As I'm the admin of the pages with "manage_pages,publish_actions" rights, there was no problem. I read some topics that talk about "publish_pages" but to use this, you need to submit your App to FB for validation. https://stackoverflow.com/a/32143270/985357

The FB support has a page that explains the differences between user and page access token. But it's unclear : https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens

I also try to get the access token of one of my Page in https://developers.facebook.com/tools/explorer but when I try to use it, I had the "(#200) The user hasn't authorized the application to perform this action".

Here is my code:

require_once dirname(__DIR__).'/include/facebook/facebook.php'; //facebook SDK
				
$this->oFB = new Facebook(array(
	'appId'  => self::FACEBOOK_APP_ID,
	'secret' => self::FACEBOOK_SECRET,  'cookie' => true));

//then

$this->oFB->api('/{MyPageId}/feed', 'post',$this->FB_params);

//with FB_params populate:
$FB_params= array('access_token' => self::FACEBOOK_ACCESS_TOKEN_PERSO,
				            'from' => self::FACEBOOK_APP_ID) ;

//... and ....
$FB_params['to'] = $FB::FACEBOOK_MY_PAGEID ;
$FB_params['message'] = "blabla....." ;
$FB_params['link'] = "url..." ;

/*the way I use to get my FACEBOOK_ACCESS_TOKEN_PERSO:
1- hit :
"https://www.facebook.com/dialog/oauth?client_id=".FACEBOOK_APP_ID."&redirect_uri=http://www.website.com/token.php&scope=manage_pages,publish_actions"
2- hit : https://graph.facebook.com/oauth/access_token?client_id=".FACEBOOK_APP_ID."&redirect_uri=http://www.website.com/token.php&client_secret=".FACEBOOK_SECRET."&code=".$_GET['code']
3- access token-> $_GET['access_token']
*/

Final question: Initially I had a unlimited access token now, with the same method, it is time limited to 2 months. Is it also a change in FB policy?

Sorry for this loOOOOong post but I hope you will understand that I search the web for a longtime without any solution. Thank you!

Answers to

Facebook: auto post on wall of a Page

Source Show
◀ Wstecz