0
我是新来的Facebook应用程序,我使用Facebook的php jdk中的示例代码进行测试。虽然我有用户名,名字等,但我没有收到电子邮件或生日信息。我在这个论坛搜索How to get Users Email Id in Facebook application using PHP?并增加了额外的行'req_perms' =>'email,user_birthday,publish_stream'
,但结果是一样的。我送你的代码:无法从Facebook应用程序获取电子邮件
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)
);
}
而在index.php
我检索电子邮件
echo "E-mail".$user_profile['email']."<br />";
感谢您的回复munjal ....我已经删除了base_facebook.php和adde在我的index.php中的行。但结果是一样的!我给你我的应用程序的URL,这可能是有用的apps.facebook.com/nitz_dola_apps – AssamGuy
见上文。我编辑了代码。 – munjal
许多许多感谢你munjal ..现在完美工作。 – AssamGuy