0

我正在尝试将具有 publish_stream 权限的图片从我的网站发布到 Facebook。出于某种原因,我发布时图片没有显示,但其他一切正常。

通过访问http://www.mysite.com/image/questions.png,图片正确显示。我错过了什么吗?

$body = array(
            'name'          => 'Join this site',
            'message'       => '',
            'description'   => 'Check this out',
            'picture'       => 'http://www.mysite.com/image/questions.png',
            'link'          => SITE_URL,
            );      
        $batchPost = array();

然后我批量发布。

4

1 回答 1

1

仔细检查它是否真的有效。

$body = array(
            'name'          => 'Join this site',
            'message'       => '',
            'description'   => 'Check this out',
            'picture'       => 'http://www.mysite.com/image/questions.png',
            'link'          => SITE_URL,
            );      
        $batchPost = array();
        $status = $facebook->api('/me/feed', 'POST', $body); 
        if (isset($status['id'])) //Add a check
        {
            echo "Message posted to wall!";
        }


如果没有,您可以使用 JavaScript SDKFB.ui方法发布到 Facebook Wall。我认为它更灵活,因为用户可以输入自己的消息,这与开发人员通过 PHP SDK 方法定义的方式不同。

JavaScript SDK FB.ui 方法

<script>
function postToWall()
        {
            var obj = {
              method: "feed",
              name: "Join this site",
              description: "Check this out",
              caption: "CAPTION",
              picture: "http://www.mysite.com/image/questions.png",
              link: "SITE_URL"
            };

            function callback(response) {
              //do something
            }

            FB.ui(obj, callback);
        }
</script>

有关 JavaScript SDK 提要对话框的更多信息:http: //developers.facebook.com/docs/reference/dialogs/feed/

Edit: Use another image and try again. http://www.mysite.com/image/questions.png has been removed. Upload your picture on some image hosting website instead of hotlinking the image directly.

于 2012-06-16T05:02:46.667 回答