2011-10-06 68 views
0

我需要一個基本的,如何指導如何從我的網頁拍照,單擊按鈕,該按鈕操作將發送特定圖像到用戶牆,用一些文字...你能告訴我完成這些步驟嗎?Facebook API(圖表)發送網站照片牆

我已閱讀Facebook的開發者論壇上,FB.ui但一切回聲出:沒有定義錯誤FB.ui事件

這裏是我在HTML文件中的代碼:

<div id="fb-root"></div> 
<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
     FB.init({appId: 'some weird number things like that : ZCWjysg4SYlkg0gZDZD', status: true, cookie: true, xfbml: true}); 
    }; 
    (function() { 
     var e = document.createElement('script'); 
     e.type = 'text/javascript'; 
     e.src = document.location.protocol + 
      '//connect.facebook.net/en_US/all.js'; 
     e.async = true; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 

和代碼在JavaScript jQuery的觸發按鈕:

FB.ui(
    { 
    method: 'feed', 
    name: 'Facebook Dialogs', 
    link: 'http://developers.facebook.com/docs/reference/dialogs/', 
    picture: 'http://fbrell.com/f8.jpg', 
    caption: 'Reference Documentation', 
    description: 'Dialogs provide a simple, consistent interface for applications to interface with users.' 
    }, 
    function(response) { 
    if (response && response.post_id) { 
     alert('Post was published.'); 
    } else { 
     alert('Post was not published.'); 
    } 
    } 
); 

我完全不知道該怎麼做......和事件在一些網站的一些代碼是錯誤的(錯誤)

我覺得這裏:http://developers.facebook.com/docs/reference/api/post/這是最好的信息來源知道怎麼回事,但我缺少的基本步驟1. 2. 3.

回答

2

從你的代碼中,APPID是錯誤的!應用程序ID是全部數字,特別是15位數,在某些地方它也被稱爲api密鑰。你發佈的內容看起來像應用程序的祕密,不應該把它放在JS中。
要獲取應用ID,您必須在開發人員應用中創建應用,或訪問this link

然後註冊Javascript SDK,可以參考this url

然後調用FB.ui方法,請參閱this url
希望這會有所幫助。