当用户仅使用 fb graph api 登录我的 facebook canvas 应用程序时,我想获取用户电子邮件?我不想使用 facebook php sdk,因为我无法使用此代码处理它(实际上,我尝试了很多但失败了)Plz帮助
$app_id = "xxxxxxx";
$canvas_page = "xxxxxxxx";
$auth_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page);
$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 ("Welcome User: " . $data["user_id"]);
echo ("Welcome User: " . $data["email"]); //i tried this
}