如何使用facebook php sdk检索facebook用户的朋友电子邮件信息

如何使用facebook php sdk检索facebook用户的朋友电子邮件信息

问题描述:

This is what I tried

if ($user) {
  try {    
  $my_access_token=$facebook->getAccessToken();

  $friends = $facebook->api('/me/friends',array('access_token'=>$my_access_token));
  echo "<pre>";
  print_r($friends);
  echo "</pre>";
  } catch (FacebookApiException $e) {
  echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
  $user = null;

} }

But this code only return the list of friends & not the friends email id

even after setting the permission like User & Friend Permissions,email in the app configuration.

Any idea?

how to get friend's email addresses

Thanks in advance!

You cannot retrieve the email address of User's Friends. Quoting from Email Permission documentation

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