如何通过API(Php SDK)以admin身份发布到Facebookpage? [英] How to post to Facebookpage as admin via API (Php SDK)?
问题描述
我知道如何使用PHP SDK通过API发布一个Facebook页面,这样做是这样的:
$facebook->api('/xxxxxxxxxxx/feed', 'post', array('message'=> 'Hello world!', 'cb' => ''));
其中xxxxxxxxxxx是页面ID;)
但是这样做,我发布到我的页面,Jamie,而不是作为页面本身(admin)。
那么如何发布为Admin / Page而不是自己?
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?
感谢您的时间!
ANSWER(对于懒惰的人):
首先,您需要确保您可以访问用户管理页面,例如:
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)以admin身份发布到Facebookpage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!