简体   繁体   中英

Post image to Facebook fan page with PHP SDK

I am trying to upload a image to my fan pages wall using the PHP SDK, and also let other people upload pics to the page.

Here is what I have thus far,

PHP:

$img = realpath($y);

$facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);

$photo = $facebook->api('/FAN_PAGE_ALBUM_ID/photos', 'POST',
    array(
        'access_token'  => $token,
        'source'        => '@' . $img,
        'message'       => 'This photo came from my app.'
    )
);

When I try that nothing happens, even though I used a similar method to post to the fan pages wall, which worked fine, I also have the appropriate permissions, as far as I know... status_update,publish_stream,user_photos,offline_access ??

Any reason why this could be happening?

For you to be able to upload pictures to a page you are an administrator of, you would most likely need manage_pages permissions. I'm not sure you can have users upload pictures to a fan page from the graph api, although they can from the website so they should be able to.

您需要以下权限:manage_pages。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM