Facebook api how to get userid and name?
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.
精彩评论