I followed the example (example.php) of this project: https://github.com/facebook/facebook-php-sdk
It runs very well and I can retrieve a lot of informations from a facebook account (name, id, first name, last name, city...) but I cannot see the user email, that is the only thing I need...
How can I modify that page to retrieve ONLY the user email?
Thanks!
but I cannot see the user email, that is the only thing I need...
You have to ask for the email
permission first, when the user logs in to your app – see https://developers.facebook.com/docs/authentication/permissions/
How can I modify that page to retrieve ONLY the user email?
After getting the permission, if you don't want all the additional fields, use the fields
parameter in your Graph API call, as in /me?fields=email (it'll still give you the user id as well, but not any other info you might not need).
You can get email by using this code
function fqlQuerynew() {
FB.api('/me', function (response) {
var query = FB.Data.query('select name,email,hometown_location, sex, pic_square from user where uid={0}', response.id);
query.wait(function (rows) {
alert(rows[0].name);
alert(rows[0].email);
alert(rows[0].sex);
alert(rows[0].pic_square);
});
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.