Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get facebook friends list email addresses?

Is there anyone who knows how to get a friends list of email address using Facebook PHP SDK?

like image 611
Mang Jose Avatar asked Jan 10 '12 02:01

Mang Jose


People also ask

Can I find friends on Facebook using their email?

On the web, type (or copy and paste) the email address of the person you want to find into the Facebook search field at the top of any Facebook page and press the Enter or Return key. On the app, tap the magnifying glass at the top of the screen, enter the email address into the search field and tap Go/Search.

How do I extract email addresses from a Facebook group for free?

Get Member Data To scrape the membership data from your Facebook groups you should use a tool called Grouply. Grouply is a chrome extension for Facebook groups that extracts data about the group members. And it puts the Facebook Group members into a CSV file you can use to import here into Toofr!

How do I export my Facebook friends list to Excel?

Click the View imported contacted link. Click the Contacts tab again. Click the Actions button and select Export All. Export your file to a yahoo CSV format (similar to Excel) or Outlook file.


Video Answer


6 Answers

No, apps can not get friend emails as stated in Email Permissions document. Quote from document:

Note: There is no way for apps to obtain email addresses for a user's friends.

like image 106
Bao Le Avatar answered Oct 20 '22 01:10

Bao Le


You cannot do that

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

email field only available for the users that connected to your application and have given email extended permission

like image 26
zerkms Avatar answered Oct 19 '22 23:10

zerkms


A user's email is a protected property and access to that information must be specifically requested by the app and granted by the user.

Note: There is no way for apps to obtain email addresses for a user's friends.

like image 21
Ashisha Nautiyal Avatar answered Oct 20 '22 01:10

Ashisha Nautiyal


Get information from this links:

Procedure

Statckoverflow discussion

If the user/friend has not given your app email permissions, chances are you won’t be able to get the email address. For instances like these, you can opt to filter just the friends who have given your app permissions. 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 Updated Answer:

$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);
like image 36
Somnath Muluk Avatar answered Oct 20 '22 01:10

Somnath Muluk


There is no way for apps to obtain email addresses for a user's friends. See the documentation https://developers.facebook.com/docs/reference/login/email-permissions/

like image 44
Narek Safaryan Avatar answered Oct 20 '22 01:10

Narek Safaryan


you have access to the user's friend list. Since these friends may not have authorized your application, you are only able to access a more limited set of data by default: only name, profile picture, gender, networks. Most other parts of the Facebook profile (e.g. interests, checkins, groups) are available via the Graph API if the user has granted you specific permissions. This applies to both the user's info as well as his/her friends' info. information is available subject to the user's privacy settings.

like image 23
VISHNU Avatar answered Oct 19 '22 23:10

VISHNU