I can get the picture with this code:
https://graph.facebook.com/userid/picture
but this doesn't work:
https://graph.facebook.com/userid/first_name
How can I get user's name ?
I can get the picture with this code:
https://graph.facebook.com/userid/picture
but this doesn't work:
https://graph.facebook.com/userid/first_name
How can I get user's name ?
You cannot get first_name
like you are getting picture.
https://graph.facebook.com/userid/?fields=first_name
will get
{
"first_name": "Jashwant",
"id": "1137725463"
}
Then you can get first_name
by any json parser.
Here's the GIVE_ME_THE_CODE version,
<html>
<head>
<style>
</style>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$.getJSON('http://graph.facebook.com/jashwantsingh?fields=first_name',function(data){
$('<p>' + data.first_name + '<p>').appendTo('body');
})
})
</script>
</head>
<body>
</body>
</html>
I have answer you this question here:
http://facebook.stackoverflow.com/questions/10663413/how-to-print-all-friendss-name/10663570#10663570
To get current user name you can make an FQL call:
FB.api({ method: 'fql.query', query: 'SELECT uid, first_name FROM user WHERE uid = me()' }, function(response) {
var user = response[0];
alert(user.first_name);
});
Also you can make a Graph API call:
FB.api('/me?fields=first_name', function(response) {
alert(response.first_name);
});
i do not know about implementation of facebook-api-graph. i used the java language to get the first name and we get the response from facebook as response.getBody()
This response will contain the data in json data format.
you can look at the below question.