這是我的代碼至今:試圖與Facebook的API來登錄用戶,並在一個PHP的網站返回的電子郵件地址
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<script>
FB.init({
appId:'xxxxxxxxxxxx', cookie:true,
status:true, xfbml:true , oauth:true, channelUrl:'http://www.federationofhumanity.com/facebookconnect/channel.html'
});</script><fb:login-button show-faces='true' width='200' max-rows='1' perms='user_birthday,user_online_presence,user_website,email'>Login using Facebook</fb:login-button><script>
FB.getLoginStatus(function(response) {
if (response.authResponse) {
document.getElementById('fb-root').innerHTML = '';
} else {
document.getElementById('fb-root').innerHTML = '';
}
});
if ($user)
</script>
(僅供參考,該代碼是通過ReadFile的命令包含在PHP腳本)。事實上,我可以將某人顯示爲「已登錄」,但我沒有任何區別他們與網站上的普通用戶。我的網站是基於PHP的。我需要獲取他們的主要電子郵件地址,以便網站可以使用它並提供他們訪問網站的個性化體驗。我需要以某種方式獲得他們的電子郵件地址,並將其變成一個變量供PHP使用。請幫助?