Facebook 好友发送电子邮件 FQL

发布于 2024-10-19 07:27:40 字数 533 浏览 5 评论 0原文

我有这个 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', ));

这是 print_r 结果:

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

)

我想获取朋友的电子邮件地址,但此查询会产生空电子邮件值。我是否错过了查询中的某些内容?甚至可以收到朋友的电子邮件吗?我和我的伴侣进行了测试,她允许该应用程序提供电子邮件地址。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦里寻她 2024-10-26 07:27:40

一般来说,您无法获取朋友的电子邮件地址 (来源):

User permission     Friends permission
email             not available

但是但是由于您的朋友已授权您的应用程序,您可以在 FQL 控制台

SELECT email FROM user WHERE uid=FRIEND_ID

我怀疑问题可能是您需要“朋友的access_token实际收到电子邮件,因为我认为您在尝试查询时以您的用户身份登录。因此,您需要授予 offline_access 权限,然后将其与查询一起使用。

但在执行上述操作之前,我会使用应用程序 access_token 进行尝试。

PS:如果您知道好友 ID,则不需要子查询。

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.

夏末 2024-10-26 07:27:40

您无法获取朋友的电子邮件地址。每个帐户必须选择与应用程序共享其电子邮件地址。朋友不能选择其他朋友加入,这是一件好事。

另外,正如 @Barkermn01 提到的,删除 AND uid = '.$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.'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文