我如何获得权限发布到Facebook页面墙
问题描述:
过去几个小时阅读developers.facebook.com后,我似乎无法弄清楚如何让我的Facebook页面允许我发布到它从Django网站的墙上?我如何获得权限发布到Facebook页面墙
答
您必须对您的应用程序给相关权限(publish_stream,管理页) 那么你可以发布到页面的页面
张贴到页面,页面,如果你有网页的access_token可以是这样的:
include_once ('src/facebook.php');/// include sdk
////// config The sdk
@ $facebook = new Facebook(array(
'appId' => 'XXXXXXX',
'secret' => 'XXXXXXXXXXXXXX',
));
try{
$post=$facebook->api('PAGE_ID/feed/','POST',array(
'message' => '$message',
'link'=>'http://apps.facebook.com/xxxxxxx/link.php?link=',
'picture'=> 'XXXXXXXXXX',
'name'=>'XXXXXX',
'description'=>'yes',
'access_token'=>'PAGE ACCESS TOKEN'
));
}
catch(FacebookApiException $e) {
echo $e->getType();
echo '<br />';
echo $e->getMessage();
}
&,如果你没有访问令牌(你又需要上述权限),我认为这可以帮助你
include_once ('src/facebook.php');/// include sdk
////// config The sdk
@ $facebook = new Facebook(array(
'appId' => 'XXXXXXX',
'secret' => 'XXXXXXXXXXXXXX',
));
$facebook->destroySession();
try{
$post=$facebook->api('PAGE ID/feed/','POST',array(
'message' => '$message',
'link'=>'http://apps.facebook.com/xxxxxxx/link.php?link=',
'picture'=> 'XXXXXXXXXX',
'name'=>'XXXXXX',
'description'=>'yes',
));
}
catch(FacebookApiException $e) {
echo $e->getType();
echo '<br />';
echo $e->getMessage();
}
要了解如何获取页面的access_token,请检查此链接: https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Faccounts