使用facebook图api搜索朋友

时间:2010-12-17 01:29:10

标签: facebook facebook-graph-api

Facebook是否有用于搜索用户朋友的API?

2 个答案:

答案 0 :(得分:6)

您可以像这样搜索好友的名字:

select uid, name, sex 
from user 
where uid in (SELECT uid2 FROM friend WHERE uid1 = me())
and (strpos(lower(name),'TheFriendName')>=0 OR strpos(name,'TheFriendName')>=0)

TheFriendName =全名或部分名称

示例:

select uid, name, sex 
from user 
where uid in (SELECT uid2 FROM friend WHERE uid1 = me())
and (strpos(lower(name),'Jack')>=0 OR strpos(name,'Jack')>=0)

答案 1 :(得分:3)

您可以使用以下API调用获取朋友列表:

Friends: https://graph.facebook.com/me/friends?access_token=...

然后在列表中搜索您要查找的人。

请参阅此处的详细文档:http://developers.facebook.com/docs/api