I know how to make a message on a Facebook page through an API using the PHP SDK, this is done as follows:
$facebook->api('/xxxxxxxxxxx/feed', 'post', array('message'=> 'Hello world!', 'cb' => ''));
Where xxxxxxxxxxx is the page id;)
But doing this, I post to this page as I, Jamie, and not as the page itself (admin).
So how do I place an admin / page in my place?
Thank you for your time!
ANSWER (for lazy people):
First of all, you need to make sure that you have access to page management for the user, for example:
<fb:login-button autologoutlink="true" perms="manage_pages"></fb:login-button>
Now you also receive a special token for each page to which the user has access as soon as you receive them.
Example PHP SDK:
//Get pages user id admin for $fb_accounts = $facebook->api('/me/accounts'); //$fb_accounts is now an array //holding all data on the pages user is admin for, //we are interested in access_token //We save the token for one of the pages into a variable $access_token = $fb_accounts['data'][0]['access_token']; //We can now update a Page as Admin $facebook->api('/PAGE_ID/feed', 'post', array('message'=> 'Hello!', 'access_token' => $access_token, 'cb' => ''));
php facebook facebook-graph-api
jamietelin
source share