当用户使用我网站上的应用程序时,如何发布到Facebook用户墙?

问题描述:

我使用PHP创建了一个Facebook应用程序,该应用程序允许用户将照片上传到我的Facebook页面.

I created a Facebook Application using PHP that allows user to upload photos to my facebook page.

现在,我希望每当用户通过此Facebook应用程序在我的墙上发布时-提示用户在他/她的墙上发布一条消息,例如约翰发布了邪恶猴墙的图片".始终让用户提示是否接受.

Now I want that whenever the user posts on my wall via this Facebook application - the user is prompted to publish a message on his/her wall such as 'John has posted a picture of Evil Monkey's Wall'. Always let the User prompt whether to accept this or not.

可以做到这一点并将其集成到我现有的Facebook应用程序中吗?能否请您提供一些示例代码?

Can this be done and integrated into my existing Facebook Application please? Can you please provide me with some sample code?

谢谢.

来自 https: //developers.facebook.com/docs/reference/dialogs/feed/

<script> 
  FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});

  function postToFeed() {

    // calling the API ...
    var obj = {
      method: 'feed',
      link: 'https://developers.facebook.com/docs/reference/dialogs/',
      picture: 'http://fbrell.com/f8.jpg',
      name: 'Facebook Dialogs',
      caption: 'Reference Documentation',
      description: 'Using Dialogs to interact with users.'
    };

    function callback(response) {
      document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
    }

    FB.ui(obj, callback);
  }

</script>