doufu7464 2013-01-13 14:40
浏览 56
已采纳

将图片上传到页面相册是可行的但是在墙上张贴图片不是

Error am getting OAuthException: (#100) picture URL is not properly formatted

I have got a very strange problem,I am able to upload pictures on my page album using graph api,but when i try to post a picture using graph api,it is not working,

Note when i post a message or a link to wall,its getting posted,the problem is only with the picture.

Here i am putting both the code snippets:

1,This is when i am trying to upload a picture to page album(working):

$facebook->setFileUploadSupport("http://apps.facebook.com/pagecron");
$x=realpath($_FILES['source']['tmp_name']);
$parameters = array('message' => $_POST['message'],'source' =>'@' . $x );
$parameters['access_token'] = $_SESSION['active']['access_token'];
$check=$facebook->api('/'.$_SESSION['active']['id'].'/photos/','POST',$parameters);

2,This is when i am trying to post a picture to the wall(Not Working):

$img = realpath($y);
$facebook->setFileUploadSupport("http://apps.facebook.com/pagecron");
$x=realpath($_FILES['source']['tmp_name']);
$parameters = array('message' => $_POST['message'],'picture' =>'@' . $x );
$parameters['access_token'] = $_SESSION['active']['access_token'];
$check=$facebook->api('/'.$_SESSION['active']['id'].'/feed/','POST',$parameters);
  • 写回答

2条回答 默认 最新

  • duanjianqu3685 2013-01-14 11:50
    关注

    Ist Thing: You need to POST to /TIMELINE_PHOTOS_ALBUM_ID/photos.

    2nd Thing:There may not be an album with such a name,so you should ist create it(After checking).

    How To:

     $albums =$facebook->api('pageid/albums',GET,array('access_token'=>'access_token');      
     foreach($albums['data'] as $album)
     {
       if($album['name'] == 'TIMELINE_PHOTOS')
       {
          $uid = $album['id'];
       }
     }
    if(isset($uid) && $uid !=0)
    {
      //mean album is there so use that uid to post your photo
    }
    else 
    {
        //create your album with that name and use its id
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算