我正在学习Post请求,为此我编写了一个基本的PHP脚本,通过telnet post请求调用。但是,当我运行它时,我没有得到预期的输出。
<?php
foreach($_REQUEST as $key=>$value)
{
echo "$key:$value<br>\n";
}
?>
telnet example.com 80
post /p.php http/1.0
host: example.com
connection:close
content-type:application/x-www-form-urlencoded
content-length:16
name=jim&age=20
HTTP/1.1 200 OK
Date: Wed, 24 Dec 2014 13:04:38 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
Connection closed by foreign host.
正如您所看到的,它没有显示输出(post请求的回显)。期待您的帮助和建议。