Well, this is the issue. I have this code, who works very well:
The code
<?php define('FACEBOOK_APP_ID', 'MY.APP.CODE'); define('FACEBOOK_SECRET', 'MY.APP.SECRET'); function get_facebook_cookie($app_id, $application_secret) { $args = array(); parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args); ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $application_secret) != $args['sig']) { return null; } return $args; } $cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <body> <?php if ($cookie) { echo("The ID is: " . $cookie['uid']); echo('<br>The profile Picture is: <IMG SRC="http://graph.facebook.com/' . $cookie['uid'] . '/picture?type=large"><br>'); } else { echo('<fb:login-button perms="email,user_birthday,publish_stream,user_status"></fb:login-button>'); } ?> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({appId: '<?= FACEBOOK_APP_ID ?>', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); }); </script> </body> </html> The output
The id is: A number here The picture is: A picture here
The problem
As you can see, this code give me the facebook's ID of the user and the profile picture when he login and give the permissions to the app. As i said, this code works fine, but i need more information, how do i retrive the email, the sex and the name using the same logic of this code?. Please do not use external libiries (like the facebook.php)
Remember that this is a very simple app so i dont want to get it complex in the code, i know that the solution have something to do with parsing JSON responses, but i cant find any good and simple code. Thanks!!!!