我知道如何使用 PHP SDK 通过 API 向 Facebook 页面发帖,方法如下:
$facebook->api('/xxxxxxxxxxx/feed', 'post', array('message'=> 'Hello world!', 'cb' => ''));
其中 xxxxxxxxxxx 是页面 ID ;)
但这样做时,我以 Jamie 的身份发布到该页面,而不是以页面本身(管理员)的身份发布。
那么我如何以管理员/页面而不是我自己的身份发帖呢?
感谢您的宝贵时间!
回答(对于懒惰的人):
首先您需要确保您有权为用户管理页面,例如:
<fb:login-button autologoutlink="true" perms="manage_pages"></fb:login-button>
现在,一旦您获得用户有权访问的每个页面,您还可以获得一个特殊 token 。
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' => ''));
最佳答案
查看有关您的问题的注释:http://developers.facebook.com/docs/api > 授权 > 页面模拟。
长话短说,您需要 manage_pages
扩展权限。
顺便说一句,你检查过this了吗?第一个?
关于php - 如何通过 API (Php SDK) 以管理员身份发布到 Facebook 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4385597/