2011-05-13 88 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

回答