Hello, I need to do a job in my college. I need to capture data of at least 70 people can be my friends on facebook, each record will have the following attributes:
Name, Age, Location, Usage time, Tanned, shares.
My question is how do I get this, I already researched the facebook API but it returns me and when I print on the screen it leaves [Objects objects] below the code trying to get return of the name and Id's of my friends.
<!DOCTYPE html>
<html>
<body>
<script>
//inicialização facebook API
window.fbAsyncInit = function() {
FB.init({
appId : '284120131991550',
xfbml : true,
version : 'v2.9'
});
FB.getLoginStatus(function(response){
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/pt_BR/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function login(){
FB.login(function(response){
if (response.status === 'connected'){
document.getElementById('status').innerHTML = "We are connected"
}else if(response.status ==='not_authorized'){
document.getElementById('status').innerHTML = "We are not connected"
}else{
document.getElementById('status').innerHTML = "We are not logged in facebook"
}
}, {scope: 'email'});
}
function info(){
FB.api('/me/friends','GET',{"fields":"id ,name"},function(response) {
document.getElementById('status').innerHTML = response;
}
);
}
</script>
<div id="status"></div>
<button onclick="login()">Login</button>
<button onclick="info()">Infor</button>
</body>
</html>