I\'m using the Graph API and the Facebook SDK for PHP with the help of this link: https://developers.facebook.com/docs/php/howto/profilewithgraphapi/4.0.0. This is the code:
Have a look at
to get an overview what fields and edges you can query for the user object. In your case, that should be
/me?fields=id,gender,email
or
new FacebookRequest(
$session, 'GET', '/me?fields=id,gender,email'
)
Be aware that you'll need the user_email
permission to be able to request the email
field.
To get specific fields, use the getProperty()
method as described at https://developers.facebook.com/docs/php/GraphObject/#getproperty
echo $user_profile->getProperty('gender');