开发者

How to get user details using facebook connect

How can I get firstname and last name of facebook user while using f开发者_如何学Python-connect?

I can login using api, but I couldn't get firstname and lastname of logged in user.


You have to invoke users.getInfo. In PHP, you would do it like this:

$userId = 1234567;
$fb = new Facebook(FACEBOOK_API_KEY, FACEBOOK_SECRET);
$fb->api_client->users_getInfo($userId, 'name, pic_square, first_name');

You can check the function's documentation here.


$client = new FacebookRestClient(API_KEY, SECRET_KEY, SESSION_KEY);
$userinfo = $client->users_getInfo($client->users_getLoggedInUser(), array('first_name','last_name'));
echo $userinfo[0]['first_name'] . ' ' . $userinfo[0]['last_name'];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜