我知道这很简单,但如果我用这样的telnet发出请求,我就无法解决这个问题:
machine:~ user$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
POST / HTTP/1.1
Host: localhost
Content-Length: 7
vari=e3
HTTP/1.1 200 OK
Date: Thu, 10 Jul 2014 18:06:33 GMT
Server: Apache/2.2.26 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.6 PHP/5.5.10 mod_ssl/2.2.26 OpenSSL/0.9.8y DAV/2 mod_perl/2.0.8 Perl/v5.18.2
X-Powered-By: PHP/5.5.10
Content-Length: 7
Content-Type: text/html
VARI =
vari变量没有设置......响应应该有VARI = e3因为我有一个输出它的PHP行:
echo "VARI = ".$_POST['vari'];
exit;
但是这个变量并没有出现。我错过了什么吗?
答案 0 :(得分:2)
尝试添加Content-type
标题:
Content-type: application/x-www-form-urlencoded