如何从Facebook应用程序访问用户信息 [英] how to access user information from facebook application

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

问题描述

请给我一些想法,即使我已经创建了一个在Facebook上注册的应用程序,通过Facebook应用程序访问用户的信息,允许用户添加该应用程序,以便我们可以通过注册的应用程序访问用户的信息。
请尽快回复我

解决方案

这将取决于您要查找的信息量用户。您可以使用signed_request对象获取已登录的用户:

 列表($ encoded_sig,$ payload)= explode ',$ signed_request,2); 
$ data = json_decode(base64_url_decode($ payload),true);

从数据获取用户

  $ user = $ data-> user; 

一旦您拥有验证和登录的用户,您可以使用图形API来获取您的只要您已经正确设置了您的权限,就想要使用者:

  $ user_profile = $ facebook-> api '/我', 'GET'); //与$ facebook是您的身份验证的FB对象

$ user_profile将具有关于此链接上列出的用户:
FB用户对象



让我知道这是你正在问的。以上信息是基于PHP程序,您也可以使用FBJS代码执行大部分操作。


Please give me some idea that how to access user's information through facebook application even though i have created one app which was registered in facebook which allow the users to add with that application so that we can access the user's information through the registered application. Please reply me soon as possible

解决方案

That's going to depend on how much information you're looking to get about the user. You can use the signed_request object to get the user that's signed in:

 list($encoded_sig, $payload) = explode('.', $signed_request, 2); 
 $data = json_decode(base64_url_decode($payload), true);

And from the data get the user

$user = $data->user;

Once you have a verified and logged in user, you can use the graph API to get back what you want about the user as long as you've set up your permissions correctly:

    $user_profile = $facebook->api('/me','GET');  //  with $facebook being your authenticated FB object  

The $user_profile will have all of the information about the user that's listed on this link: FB User Object

Let me know if that's what you were asking about. The above information is based on a PHP program, you can do most of that with the FBJS code as well.

这篇关于如何从Facebook应用程序访问用户信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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