How can I get a list of facebook friends email addresses?

Is there anyone who knows how to get email friends list using the PHP PHP SDK?

+8
email facebook facebook-friends
source share
6 answers

You cannot do it

http://developers.facebook.com/docs/reference/api/permissions/

email field is only available to users connected to your application and provided email extended permission.

+8
source share

No, applications cannot receive friends' emails as indicated in Email Rights . Quote from the document:

Note. Applications cannot retrieve email addresses for user friends.

+5
source share

A user email address is a protected property, and access to this information must be specifically requested by the application and provided by the user.

Note. Applications cannot retrieve email addresses for user friends.

+3
source share

Get information from these links:

Procedure

Statckoverflow Discussion

If the user / friend has not granted you permission to access the email, most likely you will not be able to get the email address. For such cases, you can select the filter only for friends who have granted permissions for your application. This can be done using the is_app_user field:

 SELECT uid, first_name, last_name FROM user WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = $userId) 

Get an updated response:

 $appId = 'YOUR_APP_ID'; $appSecret = 'YOUR_APP_SECRET'; $userId = 'A_FACEBOOK_USER_ID'; $userAccessToken = 'THE_FACEBOOK_USER_ACCESS_TOKEN'; $client = new Facebook(array('appId' => $appId, 'secret' => $appSecret)); // get all friends who has given our app permissions to access their data $fql = "SELECT uid, first_name, last_name, email FROM user " . "WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = $userId)"; $friends = $client->api(array( 'method' => 'fql.query', 'access_token' => $userAccessToken, 'query' => $fql, )); // make an array of all friend ids $friendIds = array(); foreach ($friends as $friend) { $friendIds[] = $friend['uid']; } // get info of all the friends without using any access token $friendIds = implode(',', $friendIds); $fql = "SELECT uid, first_name, last_name, email FROM user WHERE uid IN ($friendIds)"; $friends = $client->api(array( 'method' => 'fql.query', 'query' => $fql, // don't use an access token )); // we should now have a list of friend infos with their email addresses print_r($friends); 
+1
source share

It is not possible for applications to receive email addresses for friends of a user. See the documentation https://developers.facebook.com/docs/reference/login/email-permissions/

+1
source share

You have access to your friends list. Since these friends may not allow your application, you can access a more limited default data set: only name, profile picture, gender, network. Most other parts of your Facebook profile (e.g. interests, checks, groups) are accessible through the Graph API if the user has granted you specific permissions. This applies to both user information and information of his friends. Information is available in accordance with the user's privacy settings.

+1
source share

All Articles