用php在facebook用户的墙上发布图像

时间:2011-05-13 14:21:15

标签: php facebook

有没有办法将图像发送到Facebook用户的墙上?要发布文本,我使用以下代码:

$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/< - param被称为图片,所以你这样做:

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

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

1 个答案:

答案 0 :(得分:0)

以下是使用Java进行此操作的链接...也许您可以将其用于某些想法。

Android - Upload photo to Facebook with Facebook Android SDK

检查facebook php sdk。它应该在那里。

https://github.com/facebook/php-sdk/