jam*_*lin 7 php facebook facebook-graph-api
我知道如何使用PHP SDK通过API发布到Facebook页面的帖子,如下所示:
$facebook->api('/xxxxxxxxxxx/feed', 'post', array('message'=> 'Hello world!', 'cb' => ''));
Run Code Online (Sandbox Code Playgroud)
其中xxxxxxxxxxx是页面ID;)
但是这样做,我作为我发布到那个页面,杰米,而不是作为页面本身(管理员).
那么如何以Admin/Page而不是我自己的身份发布?
谢谢你的时间!
答案(对于懒人):
首先,您需要确保您有权管理用户的页面,例如:
<fb:login-button autologoutlink="true" perms="manage_pages"></fb:login-button>
Run Code Online (Sandbox Code Playgroud)
现在,您还可以获取每个用户访问后可访问的页面的特殊标记.
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' => ''));
Run Code Online (Sandbox Code Playgroud)
查看有关您的问题的说明:http://developers.facebook.com/docs/api >授权>页面模拟.
长话短说,你需要manage_pages延长的许可.
顺便问一下,你先检查一下吗?