Facebook应用用户列表 [英] Facebook App Users List

查看:112
本文介绍了Facebook应用用户列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Facebook的API很新。我想得到一个还安装了我的应用程序的朋友列表。 (想法是你可以和他们开始一个游戏)。



这里列出了我的朋友:

  FB.api('/ me / friends',... 

这给了我的应用信息:

  FB.api('/ myappid',... 

我想要什么是我的朋友谁也有这个应用程序安装



我以为可能是这样的:

  FB.api('/ myappid / accounts',... 

我希望至少给我我的开发人员,管理员或测试人员,但没有这样的运气
http://developers.facebook.com/docs/test_users/
http://developers.fa cebook.com/docs/ApplicationSecurity/



我的感觉可能是我必须使用FQL来构建一个类似于

$ b的查询
$ b

 (psuedocode)
SELECT
FROM my_friends
WHERE uid IN(
SELECT uid
FROM app_users
WHERE appid = myappid

任何建议将不胜感激。



请注意,我看到这篇文章:



我正在保留属于我网站的Facebook用户ID的本地列表,我实际上可以通过执行以下操作来实现我的目标,但我相信必须有一个更好的方法:

  $ facebookFriendIds = array(); 
$ friends = $ this-> facebook-> api('/ me / friends');
foreach($ friends ['data'] as $ friend){
$ facebookFriendIds [] = $ friend ['id'];
}

$ this-> friends = Doctrine_Core :: getTable('User') - > createQuery()
- > whereIn('fb_user_id',$ facebookFriendIds )
- > execute();


解决方案

这是我相信FQL查询



$ facebook-> api(array('method'=>'fql.query','query'=>SELECT uid FROM user WHERE is_app_user ='1'AND uid IN(SELECT uid2 FROM friend WHERE uid1 ='。$ user_id。');));



(我使用java和JS API,所以语法可能不完全正确)



用户和朋友查询的文档在这里:



http://developers.facebook.com/docs / reference / fql / user /



http://developers.facebook.com/docs/reference/fql/friend/


I am fairly new to the Facebook APIs. I want to get a list of my friends who have also installed my app. (The idea being you can then start a game with them).

This gives a list of my friends:

FB.api('/me/friends', ...

This gives my app info:

FB.api('/myappid', ...

What I want is "my friends who also have this app installed"

I thought it might be this:

FB.api('/myappid/accounts', ...

I was hoping that would at least give me my Developers, Administrators or Testers, but no such luck. http://developers.facebook.com/docs/test_users/ http://developers.facebook.com/docs/ApplicationSecurity/

My feeling is perhaps I have to use FQL to construst a query that says something like

(psuedocode)
SELECT
FROM my_friends
WHERE uid IN (
    SELECT uid
    FROM app_users
    WHERE appid = myappid
)

Any advice would be greatly appreciated.

Note, I have seen this post: FaceBook app: retrieve list of ids of my application's users

I am keeping a local list of Facebook User's IDs that belong to my site, and I am actually able to achieve my goal by doing the following, but I am sure there must be a better way:

$facebookFriendIds = array();
$friends = $this->facebook->api('/me/friends');
foreach ($friends['data'] as $friend) {
    $facebookFriendIds[] = $friend['id'];
}

$this->friends = Doctrine_Core::getTable('User')->createQuery()
    ->whereIn('fb_user_id', $facebookFriendIds)
    ->execute();

解决方案

This is I believe the FQL query

$facebook->api(array('method' => 'fql.query', 'query' => "SELECT uid FROM user WHERE is_app_user = '1' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = '" . $user_id . "');"));

(I use java and JS APIs so the syntax may not be exactly correct)

The documentation for the user and friend queries are here:

http://developers.facebook.com/docs/reference/fql/user/

http://developers.facebook.com/docs/reference/fql/friend/

这篇关于Facebook应用用户列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆