Facebook FQL Email Friends

I have this FQL:

$femail = $facebook->api(array( 'method' => 'fql.query', 'locale' => 'en_US', 'query' => 'SELECT email FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user_id.') AND uid = '.$friend_id.' ORDER BY name ASC', )); 

Here is the result of print_r :

 Array ( [0] => Array ( [email] => ) ) 

I want to get a friend's email address, but this query results in empty email values. Am I missing something in the request? Is it possible to get friends email? I checked with my partner, she gave permission to the application to indicate an email address.

+1
php facebook facebook-fql
source share
2 answers

In general, you CANNOT get your friends email address ( source ):

 User permission Friends permission email not available 

BUT , but since your friend has allowed your application, you can try the following in the FQL console :

 SELECT email FROM user WHERE uid=FRIEND_ID 

I suspect the problem is that you need a "friend" access_token to actually receive the email, because I assume that you are logged in as yours when you tried your request. Therefore, you need to grant offline_access permission, and then use it with the request.

But before doing this, I will try it with the access_token application.

PS: a subquery is not needed if you know a friendโ€™s identifier.

+3
source share

You cannot receive friends email addresses. Each account must refuse to share its email address with the application. Friends cannot choose other friends, which is good.

Also, as @ Barkermn01 mentioned, discard AND uid = '. $ friend_id. '

-2
source share

All Articles