我想要一个分享用户时间线特定数据的Facebook分享按钮?

时间:2014-01-02 08:40:37

标签: php facebook facebook-graph-api

我不熟悉使用facebook API,但我希望在我的网站上有一个facebook分享按钮,该按钮在登录Facebook后分享用户时间线上的特定数据。我已经阅读了一些相关的文档,并在我的localhost上创建了一个用于测试目的的页面。但有个问题 页面是,

<!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>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>Untitled Document</title>
</head>

<script>
function fbs_click(){
    u=location.href;
    t=document.title;
    d='param kumar';
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'t='+encodeURIComponent(t)+'&d'+encodeURIComponent(d),'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
 }
</script>
<body>
<div>
   <h2>Some content of my website pages..</h2>
</div>
<div id="fb">
   If a tag can have multiple values, just put multiple versions of the same tag on            your page. The first tag (from top to bottom) is given preference during conflicts.&nbsp;&nbsp;&nbsp;
   <a href="http://www.facebook.com/share.php?u=http://localhost/paramRND/FbShare.php" onclick="return fbs_click()" target="_blank"> Share on FB</a>
</div>
</body>
</html>

但是当我点击Fb按钮上的共享时,登录Facebook后会显示一个空白页面。 谁能帮我吗。感谢

1 个答案:

答案 0 :(得分:0)

你的网址//localhost/paramRND/FbShare.php它不适用于它。现在的网址。

OR 您可以使用localtunnel访问本地计算机。您需要(暂时)更改应用代码/ html中使用的某些网址,以便链接指向临时域,但至少Facebook可以访问您的计算机。