Facebook 登录网址代码 :
$this->set("facebookUrl",$this->facebook->getLoginUrl(
array(
'scope' => 'email,publish_actions',
'redirect_uri' =>"http://redirected_url"
'display'=>"popup"
)
));
在脸书代码上发布故事:
$params = array(
"access_token" => "access_token_of_logged_in_user",
"message" => "Testing facebook post",
"picture" => "https://i.stack.imgur.com/Og6yH.jpg?s=128&g=1",
"caption" => "www.pontikis.net",
"description" => "Description of post."
);
$myProfile = $this->facebook->api('/me');
$permissions = $this->facebook->api('/me/permissions');
pr($permissions);
try {
$ret = $this->facebook->api('/'.$myProfile['id'].'/feed', 'POST', $params);
echo 'Successfully posted to Facebook';
}
catch(Exception $e) {
echo $e->getMessage();
}
此处显示的权限:
Array
(
[data] => Array
(
[0] => Array
(
[permission] => public_profile
[status] => granted
)
[1] => Array
(
[permission] => email
[status] => granted
)
)
)
当我在脸书上发帖时,我收到以下错误:
(#200) The user hasn't authorized the application to perform this action
如果使用的是图形 API>=v2.0,则需要通过非管理员/测试人员/开发人员用户的登录审核,然后才能在应用中使用此权限:
看
- https://developers.facebook.com/docs/apps/review/login#do-you-need-review