使用api在facebook墙上分享?

时间:2011-09-19 09:55:24

标签: php facebook api

在我的网络应用程序中,我需要一个简单的功能。我有一个URL链接,有一个Facebook按钮,用户被提示分享他/她的墙上的网址。

图片enter image description here

中显示的类似内容

2 个答案:

答案 0 :(得分:2)

只需使用window.open或以下格式的URL:

http://facebook.com/share.php?u=http://www.google.com

晒。

答案 1 :(得分:1)

 <script type="text/javascript">
        function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){        
            FB.ui({ method : 'feed', 
                    message: userPrompt,
                    link   :  hrefLink,
                    caption:  hrefTitle,
                    picture: 'http://192.168.1.5/FrostBox1.0/photo/share_photo.jpg'
           });
           //http://developers.facebook.com/docs/reference/dialogs/feed/

        }
        function publishStream(){
            streamPublish("Stream Publish", 'Check my public link!', 'Public Link!', 'www.frostbox.com/link', "Public Link to my File");
        }

        function newInvite(){
             var receiverUserIds = FB.ui({ 
                    method : 'apprequests',
                    message: 'Come on man checkout my applications. visit http://ithinkdiff.net',
             },
             function(receiverUserIds) {
                      console.log("IDS : " + receiverUserIds.request_ids);
                    }
             );
             //http://developers.facebook.com/docs/reference/dialogs/requests/
        }
    </script>
</head>

<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
 <script type="text/javascript">
   FB.init({
     appId  : 'fffffffffff',
     status : true, // check login status
     cookie : true, // enable cookies to allow the server to access the session
     xfbml  : true  // parse XFBML
   });

 </script>



<a href="#" onClick="publishStream(); return false;">Publish Wall post using Facebook Javascript</a>