如何查找我的朋友列表中的FaceBook用户是否连接到我的网站 [英] How to find if the FaceBook user in my friends list connected to my website

查看:142
本文介绍了如何查找我的朋友列表中的FaceBook用户是否连接到我的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请帮帮我.

我正在做一个小型应用程序,它将要求用户使用Facebook登录,一旦登录,他们会要求获得连接到我的应用程序的许可.然后,我将获得用户的朋友列表.

到现在为止都很好.

然后我还想知道FB好友列表中的用户是否连接到我的应用程序?这样我就可以在好友列表的图像旁边显示说他们已连接或未连接.

我如何获得状态.请帮助我

谢谢大家.

Hi Guys,

Please help me.

I am doing a small application, which will ask the user to login with facebook and once logged in they asked for the permission to connected to my application. Then i will get the friends list of the user.

Its good till now.

Then i also want to know if the user in the FB friends list connected to my application ???? so i can show next to the image of my friendslist saying they connected or not connected.

How can i get the status. Please help me

Thank you guys.

推荐答案

您好,

因此,大概您拥有某种形式的用户数据库,以及他们的Facebook个人资料是什么?因此,在您的数据库存储中,用户的Facebook ID也是如此.然后,当某人登录时,针对其朋友列表中的每个朋友,获取该朋友的Facebook ID,并查看它是否在您的数据库中.如果是,则表明该朋友已连接,如果未连接,则该朋友未连接到您的站点.

数据例如

用户1:
FacebookID:0001
用户名:John

用户2:
FacebookID:0002
用户名:Jane

用户2登录后,从Facebook获取她的朋友列表. Facebook返回如下内容:
好友:
朋友1:FacebookID:0001

浏览列表中的每个朋友(在此示例中为一个列表):
Hi there,

So presumably you have some form of database of your users and what their Facebook profiles are? So in your database store also the user''s Facebook ID. Then, when someone logs in, for each friend in their friend list, take the friend''s Facebook ID and see if it is in your database. If it is, voila that friend is connected, if it isn''t then that friend isn''t connected to your site.

Data e.g.

User 1:
FacebookID: 0001
Username: John

User 2:
FacebookID: 0002
Username: Jane

When User 2 logs in, get her friend list from Facebook. Facebook returns something like:
Friends:
Friend1: FacebookID: 0001

Go through each friend in the list (in this example a list of one):
FOR EACH AFriend in Friends
IF (From MyDatabase.Users WHERE FacebookID == AFriend.FacebookID SELECT Friends).COUNT > 0)
    Friend is connected
ELSE
    Friend is not connected
END FOR EACH



希望这会有所帮助,
Ed



Hope this helps,
Ed


每个Facebook用户都有一个唯一的ID.它是12-16位的唯一数字值.您需要为在应用程序中注册的每个用户将此值存储在数据库中.

因此,登录后,获取朋友列表,并逐一检查是否每个朋友都已在应用程序中注册.如果已注册,则使用其Facebook数字ID和图像URL显示其个人资料图像.
Each facebook user has a unique id. Its a 12-16 digit unique numeric value. You need to store this value in your database for every user registered in your application.

So once you log in , fetch the friends list and check one by one if each of your friend is already registered in the application or not. If they are registered , then display his profile image using his facebook numeric id and the image URL.


这篇关于如何查找我的朋友列表中的FaceBook用户是否连接到我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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