Publish image on facebook user's wall with php
Is there a way to send image to a facebook user's wall? To publish texts I use this code:
$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);
For future generations: http://developers.facebook.com/docs/reference/api/p开发者_运维知识库ost/ <- param is called picture, so you do it like this:
$args = array(
'message' => $text,
'picture' => $link2picture
);
$this->_facebook->api('/me/feed/', 'post', $args);
Here is a link to doing it in Java... perhaps you can use it for some ideas.
Android - Upload photo to Facebook with Facebook Android SDK
Check the facebook php sdk too. It should be there.
https://github.com/facebook/php-sdk/
精彩评论