2011-04-03 64 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>