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