I am trying to get Facebook name of user according to his Facebook id.
for example if my Facebook is: Mor Amit
and my Facebook id is: 875810135770071
i want to get the name of the Facebook that is: mor.amit.3
Do you know how can i do it?
*I am using java
Best How To :
Since you didn't mentioned which language you are using I'll use PHP since its easier and quicker to learn (my opinion).
If you have the ID then this link will take you the user profile:
www.facebook.com/profile.php?id=<user id digits only>
If you have the username then you can use:
Once you loaded the page lets say using PHP (curl, file_get_contents) you can find inside the content (DOM) using regex - dirty parsing:
- FB user id regex pattern:
- FB user real name regex pattern:
- FB user name regex pattern:
Its better to parse the content (you can use - Simple HTML DOM) and then traverse the DOM but that's more complex.
Have fun exploring and learning.