将图像上传到Facebook页面相册,获得#240例外

时间:2012-10-17 12:56:01

标签: php facebook wordpress facebook-graph-api

我正在尝试使用脸谱图

将图像上传到页面ablbum
$facebook->setFileUploadSupport(true);
$args = array('message' => 'Photo Caption',
'source' => '@' . realpath(ABSPATH.$image_realpath) 
, 'access_token' => $page_access_token);
$data = $facebook->api('/'. $album_id . '/photos/', 'post', $args);
print_r($data);

但它给了我这个例外

Fatal error: Uncaught OAuthException: (#240) This user isn't allowed to upload photos to this object's wall

我是该网页的管理员,我向我的应用添加了manaege_pagespublish_streamshare_itemoffline_access权限,但仍然遇到此问题

1 个答案:

答案 0 :(得分:0)

尝试在应用设置中设置范围(权限):' manage_pages '

试试这个:

$DestinationFile = 'images/filename.jpg';
$newImagePath = "@" . realpath($DestinationFile);
$response = $facebook->api(
            '/me/photos/', 'post', array(
            'access_token' => $facebook->getAccessToken(),
            'message' => 'This is an awesome tech website : http://www.technew.in ' ,
            'source' => $newImagePath
        ));
print_r($response);