Facebook好友发送电子邮件至FQL

Facebook好友发送电子邮件至FQL

问题描述:

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.

我有这个FQL: p>

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

这是 print_r code>结果: p>

  Array 
(
 [0] =>数组 
(
 [电子邮件] => 
)
 
)
  code>  pre> 
 
 

我想获取朋友的电子邮件地址,但此查询结果为空 电子邮件价值 我在查询中遗漏了什么吗? 甚至可以收到朋友的电子邮件吗? 我和我的合作伙伴一起测试过,她允许该应用发送电子邮件地址。 p> div>

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.

You can't get email addresses of friends. Each account must opt-in to sharing their email address with the application. Friends can't opt other friends in, which is a good thing.

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