Facebook opengraph表单错误
我正在试用facebook opengraph cookie配方教程,我遵循所有说明,但每次我点击上面的cook表单,它仍然显示错误。我正在使用php和heroku服务器。这是我的密码:Facebook opengraph表单错误,facebook,facebook-graph-api,facebook-opengraph,Facebook,Facebook Graph Api,Facebook Opengraph,我正在试用facebook opengraph cookie配方教程,我遵循所有说明,但每次我点击上面的cook表单,它仍然显示错误。我正在使用php和heroku服务器。这是我的密码: <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xmlns:fb="https://www.facebook.com/2008/fbml"> <head prefix="og: http://ogp.me
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# tommytechcook:
http://ogp.me/ns/apps/tommytechcook#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="145722645553824" />
<meta property="og:type" content="tommytechcook:recipe" />
<meta property="og:title" content="Stuffed Cookies" />
<meta property="og:image" content="http://fbwerks.com:8000/zhen/cookie.jpg" />
<meta property="og:description" content="The Turducken of Cookies" />
<meta property="og:url" content="https://simple-journey-2635.herokuapp.com/cook.html">
<script type="text/javascript">
function postCook()
{
FB.api(
'/me/tommytechcook:cook?recipe=https://simple-journey-2635.herokuapp.com/cook.html',
'post',
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Cook was successful! Action ID: ' + response.id);
}
});
}
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '145722645553824', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<fb:add-to-timeline></fb:add-to-timeline>
<h3>Stuffed Cookies</h3>
<p>
<img title="Stuffed Cookies"
src="http://fbwerks.com:8000/zhen/cookie.jpg"
width="550"/>
</p>
<br>
<form>
<input type="button" value="Cook" onclick="postCook()" />
</form>
</body>
</html>
OG教程应用程序
函数postCook()
{
FB.api(
“/me/tommytechcook:烹饪?食谱=https://simple-journey-2635.herokuapp.com/cook.html',
"岗位",,
功能(响应){
如果(!response | | response.error){
警报(“发生错误”);
}否则{
警报('Cook成功!操作ID:'+响应.ID);
}
});
}
window.fbAsyninit=函数(){
FB.init({
appId:'14572264553824',//应用ID
状态:true,//检查登录状态
cookie:true,//启用cookie以允许服务器访问会话
xfbml:true//解析xfbml
});
};
//异步加载SDK
(职能(d){
var js,id='facebook jssdk';if(d.getElementById(id)){return;}
js=d.createElement('script');js.id=id;js.async=true;
js.src=“//connect.facebook.net/en_US/all.js”;
d、 getElementsByTagName('head')[0].appendChild(js);
}(文件);
填充饼干
我猜您没有登录。我在任何地方都看不到FB.login()
错误消息是什么?更改
警报(“发生错误”)代码>至警报(响应.错误)
以查看错误消息
alert(response.error);
将返回“Object”
改用:
alert(JSON.stringify(response.error));
用户1304503,我很想知道你是如何解决这个问题的——我自己很难设置一个测试应用程序(一个发布到用户新闻提要的应用程序)
伍利格