【发布时间】:2013-08-12 20:55:49
【问题描述】:
在用户通过 openID 登录 Google 后,我正在尝试检索用户的电子邮件地址。
网址是:
00.000.000.000/loginwithgoogle.php?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com %2Faccounts%2Fo8%2Fud&openid.response_nonce=2013-08-12T20%3A52%3A27ZoZizKCa486SFiQ&openid.return_to=http%3A%2F%2F24.255.213.250%3A50005%2Floginwithgoogle.php&openid.invalidate_handle=ABSmpf6DNMw&openid.assoc_handle=1.AMlYA9XT63izbhULzG8CiL5xkIE9bfgIV6dQ_5xBjHZQjVnh4H5YRm4L2HSTRxYj&openid.signed =op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.email%2Cext1.value.email&openid.sig=xK06wAKPUPdu4JVgLz0v%2F1ZTMZA%3D&openid.identity=https%3A%2F%2F .google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawm70UATPuqUjklL10scHQJGXvepPFSMI48&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawm70UATPuqUjklL10scHQJGXvepPFSMI48&openid.ns.ext1=http%3A%2F%2Fopenid .net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response &openid.ext1.type.email=http%3A%2F%2Faxschema.org%2Fcontact%2Femail&openid.ext1.value.email=myemail%40gmail.com
php代码是:
<?php
echo $_POST["openid.ext1.value.email"];
echo $_GET["openid.ext1.value.email"];
?>
什么都不显示。 PHP 和 get 函数都在工作。 我相信问题是试图用'。'来获取参数。 (时期)。 我想要的只是电子邮件,所以如果我以过于复杂的方式执行此操作,我会很高兴听到替代方案。提前致谢。
【问题讨论】:
-
通过查询字符串传递的参数将永远不会出现在 $_POST 中。执行
var_dump($_GET)以查看脚本中的内容。 -
谢谢你这样做。我需要使用 '_' 而不是 '.'。
标签: php get google-openid