php – Facebook图片api照片上传到粉丝页面相册

我已经获得了照片上传功能来使用此代码,
<?PHP

include_once 'facebook-PHP-sdk/src/facebook.PHP';
include_once 'config.PHP';//this file contains the secret key and app id etc...

$facebook = new Facebook(array(
    'appId'  => FACEBOOK_APP_ID,'secret' => FACEBOOK_SECRET_KEY,'cookie' => true,'domain' => 'your callback url goes here'
));

$session = $facebook->getSession();

if (!$session) {

    $url = $facebook->getLoginUrl(array(
               'canvas' => 1,'fbconnect' => 0,'req_perms'=>'user_photos,publish_stream,offline_access'//here I am requesting the required permissions,it should work with publish_stream alone,but I added the others just to be safe
           ));

    echo 'You are not logged in,please <a href="' . $facebook->getLoginUrl() . '">Login</a> to access this application';

} else{

    try {

        $uid = $facebook->getUser();
        $me = $facebook->api('/me');
        $token = $session['access_token'];//here I get the token from the $session array
        $album_id = 'the id of the album you wish to upload to eg: 1122';

        //upload your photo
        $file= 'test.jpg';
        $args = array(
        'message' => 'Photo from application',);
        $args[basename($file)] = '@' . realpath($file);

        $ch = curl_init();
        $url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$token;
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_HEADER,false);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch,CURLOPT_POST,CURLOPT_POSTFIELDS,$args);
        $data = curl_exec($ch);

        //returns the id of the photo you just uploaded
        print_r(json_decode($data,true));

    } catch(FacebookApiException $e){
        echo "Error:" . print_r($e,true);
    }
}
?>

我希望这会有所帮助,我和朋友在墙上砸了很长时间才能让这个工作变得有效!

无论如何,这是我的问题,如何将图像上传到粉丝页面?我正在努力让这个工作,当我上传图像我得到的是照片ID但没有照片在相册中.

所以基本上,当用户点击我们的应用程序上的上传按钮时,我需要它将他们创建的图像上传到我们的粉丝专辑上,并在其上标记.

谁知道我怎么能做到这一点?

这似乎是Graph API的一个错误.看到这个 http://forum.developers.facebook.com/viewtopic.php?id=59063(无法发布链接)

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...