我不断得到:
“未捕获的 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);
任何想法我做错了什么,发布流许可被授予?