当我将图片上传到脸书时会发出错误
致命错误:未捕获OAuthException:(#200)第1325行的path_to_file / base_facebook.php中抛出权限错误
我正在使用位于此处的facebook php sdk
https://github.com/facebook/facebook-php-sdk
这是我的代码
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'FB APP ID',
'secret' => 'FB SECRET KEY',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
} else {
$loginUrl = $facebook->getLoginUrl();
header('Location:' . $loginUrl . '&scope=user_photos,publish_stream');
}
if ($user) {
if (isset($_GET['upload'])) {
$facebook->setFileUploadSupport(true);
$args = array('message' => ''.$site.'');
copy(''.$fullurl.'', 'tmp/file.jpeg');
$args['image'] = '@' . realpath('tmp/file.jpeg');
$data = $facebook->api('/me/photos', 'post', $args);
unlink('tmp/file.jpeg');
//assigning users to tag and cordinates
$argstag = array('to' => $user);
$argstag['x'] = 40;
$argstag['y'] = 40;
$datatag = $facebook->api('/' . $data['id'] . '/tags', 'post', $argstag);
}
}
有人能指出我为什么会出现这种错误吗?
答案 0 :(得分:0)
请参阅:https://developers.facebook.com/docs/facebook-login/permissions/v2.1
没有此类权限publish_stream
了,v1.0拥有它,但仅适用于网页,而不是用户。
publish_actions
是您想要的,将范围更改为此并重新请求权限..