我知道如何使用 PHP SDK 通过 API 在 Facebook 页面上发帖,具体操作如下:
$facebook->api('/xxxxxxxxxxx/feed', 'post', array('message'=> 'Hello world!', 'cb' => ''));
其中 xxxxxxxxxxx 是页面 ID ;)
但这样做时,我以我自己的身份发布到该页面,杰米,而不是页面本身(管理员).
那么我如何以管理员/页面的身份而不是我自己的身份发帖?
But doing that, I post to that page as me, Jamie, and not as the Page itself (admin).
So how do I post as Admin/Page instead of myself?
感谢您的时间!
答案(针对懒人):
首先,您需要确保您有权管理用户的页面,例如:
First of all you need to make sure you have access to manage pages for user, ex:
<fb:login-button autologoutlink="true" perms="manage_pages"></fb:login-button>
现在,一旦您获得用户有权访问的每个页面,您还将获得一个特殊的令牌.
PHP SDK 示例:
Now you also gets a special token for every page user have access to once you get them.
PHP SDK Example:
//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 > 授权 > 页面模拟.
Check out this note regarding your question: http://developers.facebook.com/docs/api > Authorization > Page impersonation.
长话短说,您需要 manage_pages 扩展权限.
Long story short, you need the manage_pages extended permission.
顺便说一句,你有没有检查这个 首先?
And btw, have you checked this first ?
这篇关于如何通过 API (Php SDK) 以管理员身份发布到 Facebookpage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 SELECT(MYSQL/PHP) 中加入 2 个表Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 个表)
如何使<option selected=“selected">由How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 设置?)
使用 PHP 中的数组自动填充选择框Auto populate a select box using an array in PHP(使用 PHP 中的数组自动填充选择框)
PHP SQL SELECT where like search item with multiple wordsPHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(),名称 ASCMySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名称 ASC)