2011-05-13 90 views
2

有没有办法将图像发送到Facebook用户的墙?要发布文章我用这个代码:在facebook用户的墙上用php发布图像

$arpost = array(
      'message' => $text, 
      'access_token' => $token 
     ); 

     $ch = curl_init(); 

     curl_setopt($ch, CURLOPT_URL, $url); 
     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arpost)); 
     curl_setopt($ch, CURLOPT_POST, true); 
     curl_setopt($ch, CURLOPT_HEADER, 0); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 

     $result = curl_exec($ch); 

     curl_close($ch); 

为了子孙后代:http://developers.facebook.com/docs/reference/api/post/ < - 参数是所谓的照片,让你做这样的:

$args = array(
     'message' => $text, 
     'picture' => $link2picture 
    ); 

    $this->_facebook->api('/me/feed/', 'post', $args); 
+0

根据该链接,有没有建议处理我的问题......而主题中的链接指向一个旧的解决方案。我使用图形API。 – marek 2011-05-13 14:29:46

回答