PHP SDK到Facebook页面帖子,未捕获的OAuthException:(#200) [英] PHP sdk to facebook page post, Uncaught OAuthException: (#200)
问题描述
我不断得到:
未捕获的OAuthException:(#200)用户未授权应用程序执行此操作"
require_once("resources/facebook_sdk/facebook.php");
$app_id = 'appid';
$app_secret = 'appsecret';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$user = $facebook->getUser();
if($user)
{
$access_token= $facebook->getAccessToken();
}
else {
$loginUrl = $facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'scope' => 'offline_access,read_stream,user_photos,user_videos,publish_stream,manage_pages'
));
echo ("<script> top.location.href='".$loginUrl."'</script>");
}
$req = array(
'access_token' => $access_token,
'name' => 'My wall post',
'message' => 'tralalala',
'caption' => "www.mysite.com",
'link' => 'http://www.mysite.com',
'description' => 'Wall post',
'picture' => 'http://farm6.static.flickr.com/1111/some-pic.jpg',
'actions' => array(array('name' => 'My Site',
'link' => 'http://www.mysite.com'))
);
print_r($req);
$res = $facebook->api('/pageid/feed' ,'post',$req);
if ($res) echo "succes";
else echo "fail";
print_r($res);
有什么想法我做错了,是否授予发布流许可?
考虑到您拥有服务器的所有权限可以上传到Facebook.请查看以下一些链接以获取更多信息,
Facebook API OAuthException:(#200)
Facebook Open Graph API返回:( #200)需要扩展权限:publish_actions
在尝试执行以下操作时未捕获的OAuthException:(#200)在墙上张贴
多用户事件邀请图形API失败,权限错误:200 OAuthException >
您已授予您在范围内定义的所有权限,
'scope'=>'offline_access,read_stream,user_photos,user_videos,publish_stream,manage_pages';
可能会帮助您.
I keep getting:
"Uncaught OAuthException: (#200) The user hasn't authorized the application to perform this action"
require_once("resources/facebook_sdk/facebook.php");
$app_id = 'appid';
$app_secret = 'appsecret';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$user = $facebook->getUser();
if($user)
{
$access_token= $facebook->getAccessToken();
}
else {
$loginUrl = $facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'scope' => 'offline_access,read_stream,user_photos,user_videos,publish_stream,manage_pages'
));
echo ("<script> top.location.href='".$loginUrl."'</script>");
}
$req = array(
'access_token' => $access_token,
'name' => 'My wall post',
'message' => 'tralalala',
'caption' => "www.mysite.com",
'link' => 'http://www.mysite.com',
'description' => 'Wall post',
'picture' => 'http://farm6.static.flickr.com/1111/some-pic.jpg',
'actions' => array(array('name' => 'My Site',
'link' => 'http://www.mysite.com'))
);
print_r($req);
$res = $facebook->api('/pageid/feed' ,'post',$req);
if ($res) echo "succes";
else echo "fail";
print_r($res);
Any ideas what I'm doing wrong, publish stream permission is given?
This answer is taken in to consideration that you have all rights of server to upload on Facebook.Checkout some of links below for more information,
Facebook API OAuthException: (#200)
Facebook Open Graph API returns: (#200) Requires extended permission: publish_actions
Uncaught OAuthException: (#200), when trying to post on wall
Multiuser event invite graph api fails Permissions Error:200 OAuthException
You have give all permission which you define in scope,
'scope'=>'offline_access,read_stream,user_photos,user_videos,publish_stream,manage_pages';
may help you.
这篇关于PHP SDK到Facebook页面帖子,未捕获的OAuthException:(#200)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!