I am learning about the Post request, and for this I have written a basic PHP script which is being called through a telnet post request. However, when I run it I am not getting the expected output.
The PHP code is as follows (saved as p.php):
<?php
foreach($_REQUEST as $key=>$value)
{
echo "$key:$value<br>
";
}
?>
Then from the terminal I run telnet as follows:
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
The output is as follows:
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.
So as you can see, it shows no output (echo of the post request). Looking forward to your help and advice.