开发者

Facebook api how to get userid and name?

开发者 https://www.devze.com 2023-02-23 02:24 出处:网络
I am using facebook php api for fetching data. Please help me on how to authenticate and fetch userid, name, email, gender.(I HAVE asked for email permission).

I am using facebook php api for fetching data. Please help me on how to authenticate and fetch userid, name, email, gender.(I HAVE asked for email permission).

Here is my code:

require 'facebookcredentials.php';
require 'facebookapi.php';
$facebook = new Facebook(array(
  'appId'  => $app_id,
  'secret' => $secret,
  'cookie' => true,
));

     $facebook->getLoginUrl(array('req_perms' => 
    'email,read_stream,publish_stream,create_event,rs开发者_开发问答vp_event'));

Please tell me how to first authenticate the user and then get $userid, $name, $gender, $email


You can use the example here: https://github.com/facebook/php-sdk/blob/master/examples/example.php it helps a lot...

anyway, you are looking for these: $me = $facebook->api('/me');

see the whole example though.

0

精彩评论

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