I am working on my first Facebook app with the help of Facebook’s online documentation for app development.
The issue I am facing is while authenticating I also need the gender and name of the user. The screen shot available in the above link says the ‘basic information’ I am requesting from the user contains both of them. But I don’t know how to retrieve them, they are in a JSON array I guess but I am not much familiar with JSON so may be thats why or I need extra permission for them?
<?php
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {
echo("<b class=\"welcome\">Welcome " . $data["user_id"] . ",</b><br/>");
}
?>