Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 print_r result:

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

)

I want to get friend's email address, but this query results in empty email values. Does I miss something in query? Does it even possible to get friends email? I tested with my partner, she gave permission to the app to give out email address.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
577 views
Welcome To Ask or Share your Answers For Others

1 Answer

In general, you CAN'T get the email address of your friends (source):

User permission     Friends permission
email             not available

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

SELECT email FROM user WHERE uid=FRIEND_ID

What I suspect the problem could be is that you need the "friend's" access_token to actually get the email because I suppose you are logged-in as your user when trying your query. So you need to grant the offline_access permission and then use it with the query.

But before doing the above, I would try it with an application access_token.

P.S: the sub-query is not needed if you know the friend id.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...