2011-04-03 63 views
0

將Facebook連接添加到網站並使用Graph API連接到Facebook有什麼區別?我試圖創建一個Facebook登錄功能來提取用戶的Facebook頁面的狀態信息 - 我使用社交圖譜API或「Facebook連接」?Facebook Connect和Facebook Graph API之間的區別

+0

你需要使用圖表,Facebook的連接則多爲小工具/像按鈕等找到所有你需要知道的@ http://developers.facebook.com/docs/ – 2011-04-03 01:37:39

回答

0

最簡單的方法是將javascript sdk用於圖api,儘管這也取決於您要提取的信息類型。 你可以在這裏得到的文檔:http://developers.facebook.com/docs/reference/javascript/

,並開始,這將按鈕添加日誌,並提取一些基本信息:

<HTML> 
    <HEAD> 
    <SCRIPT type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></SCRIPT> 
    </HEAD> 
    <BODY> 
    <DIV id="fb-root"></div> 
    <SCRIPT> 
     FB.init({ 
     appId : APP_ID, // You get this number when you register your app at http://www.facebook.com/developers/createapp.php 
     status : true, // check login status 
     cookie : true, // enable cookies to allow the server to access the session 
     xfbml : true // parse XFBML 
     }); 
     FB.Event.subscribe('auth.login', function (response) { 
     alert(" Welcome " + response.name); 
     }); 
     if(FB.getSession() != null) { 
     var session = FB.getSession(); 
     alert(" Your user id is " + session.uid); 
     } 
    </SCRIPT> 
    <fb:login-button autologoutlink='true' show-faces='false' width='200' max-rows='1'></fb:login-button> 
    </BODY> 
</HTML>