Facebook发布到用户的墙上

时间:2012-12-30 21:08:17

标签: facebook api facebook-graph-api

任何指导如何制作用户使用Facebook登录我的网站时,它会自动使用他们的Facebook帐户发布状态,例如“John刚加入mysite.com”,以便所有朋友都能看到。有这样的吗?

1 个答案:

答案 0 :(得分:0)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Facebook post</title>
  </head>
  <body onload="publishWallPost('{{ page.slug }}')">
    <script>
    window.fbAsyncInit = function() {
        FB.init({appId: 'Your Super Cool App ID', status: true, cookie: true, xfbml: true});
            };
        (function() {
            var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
        }());
    </script>




    <script>
    <!--
    function publishWallPost(slug) {
        var attachment = {'name':'My Super Cool Website','description':'This is a test of the Facebook Broadcast System.  If this was real, you would be reading something useful.','media':[{'type':'image','src':'http://MySuperCoolWebsite.com/images/facebook_image.png','href':'http://www.MySuperCoolWebsite.com/' + slug + '/'}]};
        FB.ui({
            method: 'stream.publish',
            message: 'I just found this Super Cool Website!',
            attachment: attachment,
            user_message_prompt: 'post this to your wall?'
        });
    }
    //-->
    </script>
  </body>
</html>
相关问题