I am new to facebook applications and I am using the example code in facebook’s php jdk for testing. Although I got the username,first name etc I am not getting the email or birthday information . I searched in this forum How to get Users Email Id in Facebook application using PHP? and added the extra line 'req_perms' =>'email,user_birthday,publish_stream' but the result is same . I am sending you the codes :
public function getLoginUrl($params=array()) {
$this->establishCSRFTokenState();
$currentUrl = $this->getCurrentUrl();
return $this->getUrl(
'www',
'dialog/oauth',
array_merge(array(
'client_id' => $this->getAppId(),
'req_perms' =>'email,user_birthday,publish_stream',
'redirect_uri' => $currentUrl, // possibly overwritten
'state' => $this->state),
$params));
/**
* Get a Logout URL suitable for use with redirects.
*
* The parameters:
* - next: the url to go to after a successful logout
*
* @param array $params Provide custom parameters
* @return string The URL for the logout flow
*/
public function getLogoutUrl($params=array()) {
return $this->getUrl(
'www',
'logout.php',
array_merge(array(
'next' => $this->getCurrentUrl(),
'access_token' => $this->getAccessToken(),
), $params)
);
}
And in index.php I retrieve e-mail
echo "E-mail".$user_profile['email']."<br />";
You have changed the facebook sdk library. You have edited the code of facebook.php. There is no need to edit the code of facebook library. Just remove the parameter from facebook library:
You have to use this parameter here:
Changed the req_perms to scope. Now it will be working fine