我開始Facebook應用程序開發,並且正在關注Facebook上的食譜盒應用程序教程。Facebook Recipe Box打開圖形教程
https://developers.facebook.com/docs/opengraph/tutorial/
我的標題下堅持「發佈的行動」它說:「現在,單擊煮飯鍵!」在我的網站上,我點擊它,並在收到錯誤消息說「發生錯誤」後不久。我遵循了我給出的步驟,除了點擊操作旁邊的「Get Code」鏈接的部分外,其中包含可以複製到終端並直接運行的捲髮代碼片段。「我不知道該如何處理curl代碼......該教程從來沒有真正說過要對它做任何事情。
下面是我現在使用的代碼。我有一個recipe.html文件和一個objectpage.html,這是我點擊廚師按鈕並得到錯誤。預先感謝您提供的任何幫助!
recipe.html:
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>OG Tutorial App</title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '266155930158877', // 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:login-button show-faces="true" width="200" max-rows="1" scope="publish_actions">
</fb:login-button>
<h3>Stuffed Cookies</h3>
<p>
<img title="Stuffed Cookies"
src="http://fbwerks.com:8000/zhen/cookie.jpg"
width="550"/>
</p>
</body>
</html>
objectpage.html
<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# rk_recipebox:
http://ogp.me/ns/apps/rk_recipebox#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="266155930158877" />
<meta property="og:type" content="rk_recipebox: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="http://fbwerks.com:8000/zhen/cookie.html">
<script type="text/javascript">
function postCook()
{
FB.api(
'/me/rk_recipebox:cook',
'post',
{ recipe: 'http://fbwerks.com:8000/zhen/cookie.html' },
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 : '266155930158877', // 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>
<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>
頁位於:
http://glutendatabase.com/objectpage.html
謝謝!這是問題所在。我在postCook()函數中沒有自己的URL,並且在頂部附近的og:url meta標籤中也沒有自己的URL。現在我終於可以繼續教程了。再次感謝! –