当有人订阅我的列表时,我会从自动回复器 (getResponse) 接收 GET 变量,并且我需要在另一个 GET 请求中将这些变量传递给调查提供者。我使用 PHP“header()”函数,但“@”字符从电子邮件中被删除。
这是我的 PHP 代码:
// retrieve email from GET
$email = $_GET['email'];
// pass on email
header("Location: http://surveyprovider.com/surveyID/start?email=$email");
假设当 getResponse 调用我的 PHP 脚本时,我得到"[email protected] "。当我的脚本运行时,生成的 HTTP 调用如下所示:
http://surveyprovider.com/surveyID/start?email=someguysomeserver.com
注意到电子邮件地址中如何缺少“@”吗?
如何解决这个问题?
我无法使用 session 变量(如本问题中的建议: How to pass variables received in GET string through a php header redirect? ),因为调查提供程序不允许我检索 session 变量(无自定义 PHP 脚本)。
我能做什么?
最佳答案
您需要对该 URL 进行正确编码。您目前没有发送有效的网址。
header('Location: http://surveyprovider.com/surveyID/start?email=' . urlencode($email));
@
变为 %40
:
http://surveyprovider.com/surveyID/start?email=test%40example.com
关于php - 在 PHP header 重定向中传递电子邮件 - 删除 "@"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18134924/