저는 페이스 북 API로 처음으로 작업하고 있습니다. 거기에서 우리는 아래에 이름을 불러올 수 있음을 발견했다. console.log (response.name); 하지만 전자 메일 및 fbid도 가져올 수 있습니까?그래프 API를 사용하여 페이스 북 로그인을 사용하여 사용자 이메일 및 ID를 얻는 방법
감사합니다, Enamul
<?php ?>
<div id="fb-root"></div>
<script>
// Additional JS functions here
window.fbAsyncInit = function() {
FB.init({
appId : 'f', // App ID
channelUrl : '//localhost/practices/phpTest/fblogin/login.php/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
} else if (response.status === 'not_authorized') {
// not_authorized
login();
} else {
// not_logged_in
login();
}
});
// Additional init code here
};
function login() {
FB.login(function(response) {
if (response.authResponse) {
// connected
testAPI();
} else {
// cancelled
}
});
}
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
});
}
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<?php ?>
은 끝났습니까? 의견이 없으면 대답하고, 그렇다면 답을 받아들입니다. – ThePCWizard
@ThePCWizard 늦게 받아 들여서 죄송합니다. 나는 그것을 시험 할 수 없기 때문에 얼마간 떨어져있었습니다. – user1559230