Php Facebook表单提要对话框-链接属性错误
我在将URL变量传递到Facebook提要对话框时遇到问题。当我按下按钮时,我可以在链接中看到它,但一旦我在Facebook上发布它,我就会得到所有信息,直到Php Facebook表单提要对话框-链接属性错误,php,html,facebook,Php,Html,Facebook,我在将URL变量传递到Facebook提要对话框时遇到问题。当我按下按钮时,我可以在链接中看到它,但一旦我在Facebook上发布它,我就会得到所有信息,直到& 这是我的密码: <a href="https://www.facebook.com/dialog/feed? app_id=142170752632916& redirect_uri=http://domain.com/& link=$currentUrl& picture=http://fbrel
&
这是我的密码:
<a href="https://www.facebook.com/dialog/feed?
app_id=142170752632916&
redirect_uri=http://domain.com/&
link=$currentUrl&
picture=http://fbrell.com/f8.jpg&
name=$title&
description=$description">Share</a>
$currentUrl = $_SERVER['REQUEST_URI'] ;
一旦我在Facebook上发布,我会得到以下链接:
www.Domain_Name.com/index.php?subaction=showfull
并且不传递id或其他属性
我能做些什么来修复它
编辑:
以下是我尝试在提要上发布链接后得到的结果:
https://www.facebook.com/dialog/feed?%20%20app_id=142170752632916&%20%20redirect_uri=http://domain.com /&%20%20link=http://www.domain.com/FrontEnd/index.php?subaction=showfull&id=1368007502&start_from=3&template=Default&&%20%20picture=http://fbrell.com/f8.jpg&%20%20name=bbb&%20%20description=bbb
在看了facebook之后,看起来真正的魔力在于回调函数
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
这是将附加参数?post_id=12345
添加到urlhttps://mighty-lowlands-6381.herokuapp.com/
。因此,请遵循下面的示例,facebook提供了确保回调函数中的参数与URL中所需的参数一致的示例,
即subaction=showfull&id=1368007502&start\u from=3&template=Defaultdiscus\u thread
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
<script>
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
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>
</body>
</html>
我的提要对话框页面
投递
init({appId:“您的应用程序ID”,状态:true,cookie:true});
函数postToFeed(){
//正在调用API。。。
var obj={
方法:“提要”,
重定向_uri:'您的URL在此',
链接:'https://developers.facebook.com/docs/reference/dialogs/',
图片:'http://fbrell.com/f8.jpg',
名称:“Facebook对话”,
标题:“参考文档”,
描述:“使用对话框与用户交互。”
};
函数回调(响应){
document.getElementById('msg').innerHTML=“Post ID:”+response['Post_ID'];
}
FB.ui(obj,回调);
}
您需要将传递的所有内容作为URL参数保存。现在,URL有两个单独的查询字符串部分。Facebook的URL解析器可能会忽略第二个问号,并将后面的项目作为外部URL的参数进行解析。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
<script>
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
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>
</body>
</html>