我已经实现了本页所示的代码:http://developers.facebook.com/docs/reference/dialogs/feed/
问题:对象中的所有字段都填写正确,并且也正确地发布到了facebook,除了图片。
<?php
if(isset($_POST['successmessage'])) {
echo '<div class="info_message" style="margin:0 10px 10px 10px">
<div style="float:left;display:inline;width:200px">
<strong>'.$lang['checkout_text_42'].' '.$lang['checkout_text_43'].'</strong>
<br>'.$lang['checkout_text_44'].'
</div>
<div style="float:left;display:inline">
<a onclick="postToFeed(); return false;" style="cursor:pointer;float:left"><img src="images/post-design-to-fb.png" style="margin-top:4px"></a>
<div id="msg" style="line-height:34px;float:left;margin-left:10px"></div>
</div>
<div style="clear:left"></div>
</div>';
?>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/<?php echo $locale; ?>/all.js'></script>
<script>
FB.init({appId: "123455666777", status: true, cookie: true });
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'http://www.mydomain.com/configurator.php?id=<?php echo $_SESSION['sharetofb'];?>&lang=<?php echo $language;?>',
picture: 'http://www.mydomain.com/images/designs/design-<?php echo $_SESSION['sharetofb'];?>.png',
name: 'I just designed a DIY T-Shirt. Awesome!',
caption: 'Click to check it out and customize it.',
description: 'Choose from 500 different materials, colors, prints, shapes to assemble your unique custom T-Shirt.'
};
function callback(response) {
if (response && response['post_id']) {
document.getElementById('msg').innerHTML = "Your design was posted successfully!";
}
}
FB.ui(obj, callback);
}
</script>
<?php
}
?>
如果我使用上面提到的facebook文档中给出的直接URL示例,并将URL复制/粘贴到浏览器中(用我的应用程序ID、URL和内容代替),它也会显示除图片之外的所有内容。
奇怪的是:它昨天展示并发布了这张照片。然而,经过几次测试、发布和删除我墙上的测试帖子后,它不再发布图片了。
我在stackoverflow上搜索了所有的问题和答案,可以排除图片url中有破折号的问题。我真的搞不清楚,而且几乎不知道脸书会屏蔽帖子图片,如果做得太频繁的话??
感谢任何能让我找到解决方案的提示。
您尝试过使用静态图片吗?它有效吗?也许这取决于您传递给它的变量。