0

其次確切的指示按?代碼如下:無法發佈樣品的Open Graph按照指令

======================================== ========================

<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# test_app: 
http://ogp.me/ns/apps/test_app#"> 
<meta property="fb:app_id" content="129xxxxxxxxxxxx" /> 
<meta property="og:type" content="test_app:recipe" /> 
<meta property="og:title" content="Stuffed Cookies" /> 
<meta property="og:image" content="http://x.example.com/cookedrcp.jpg" /> 
<meta property="og:description" content="The Turducken of Cookies" /> 
<meta property="og:url" content="http://apps.facebook.com/test_app/index.php"> 

<script type="text/javascript"> 
function postCook() 
{ 
    FB.api('/me/test_app:cook' + 
       '?recipe=http://apps.facebook.com/test_app/index.php','post', 
       function(response) { 
     if (!response || response.error) { 
       alert('Error occured'); 
     } else { 
      alert('Post was successful! Action ID: ' + response.id); 
      } 
    }); 
} 
</script> 
</head> 

<body> 
<div id="fb-root"></div> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
<script> 
    FB.init({ 
     appId:'129xxxxxxxxxxxx', cookie:true, 
     status:true, xfbml:true, oauth:true 
    }); 
    </script> 

    <fb:add-to-timeline></fb:add-to-timeline> 

    <h3> 
     <font size="30" face="verdana" color="grey"> 
      Stuffed Cookies 
     </font> 
    </h3> 
    <p> 
     <img title="Stuffed Cookies" 
         src="http://x.example.com/cookedrcp.jpg" 
         width="550"/><br /> 
    </p>  

    <form> 
     <input type="button" value="Cook" onclick="postCook()" /> 
    </form> 
</body> 
</html> 

=================== ==================================================

我已經創建了開放式圖形作爲樣品每頁面如烹飪食譜。

任何幫助將不勝感激。

+0

你會得到任何JavaScript錯誤?您是否嘗試過使用[Facebook調試器工具](https://developers.facebook.com/tools/debug)查看Facebook如何查看您的網址? – Lix 2012-01-05 17:15:13

+0

你的'response.error'是什麼? – 2012-01-05 18:38:27

回答

0

我有一種感覺,你沒有得到用戶的有效的access_token。在文檔(https://developers.facebook.com/docs/beta/opengraph/tutorial/#publish)中,它表示您的用戶需要已經通過了應用程序的身份驗證。在調用FB.api()之前,確保當前用戶通過調用FB.getLoginStatus()進行驗證。