Follow these steps:
Get the basic overview here: FB for sites and Graph API.
Learn about Access Tokens
Learn about Graph API Explorer- for testing.
Login
the user with facebook. There are many ways to do this, one simpler way is described here: Add the Login Code and replaceFB.login()
with :FB.login(function(response){ if(response.status == 'connected'){ //alert('I am connected') } },{scope: 'email, user_photos'}); // since you need to fetch email and the user photos from fb
Then, you can fetch the user details using facebook API, just like:
FB.api('/me/albums', function(response) { alert(response.name); });
You can see what all ab
Album
object gives you, here.
You can also use PHP instead of JS if you wish, works almost similar. PHP SDK Reference. Also, you can check out some samples here. (but dont let them confuse you)
Hope that helps!