我已经用PHP制作了一个简单的网页来测试通过Telnet进行POST请求。 以下是该网页的代码(example.php):
<html>
<body>
<form method="post" action="example.php>">
Your Name:<input type="text" size="12" maxlength="12" name="Name"><br />
<input type="submit" value="submit" name="submit">
</form>
<?php echo $_POST["Name"]; ?>
</body>
</html>
这个在浏览器中可以工作,但我想从telnet测试它。我尝试过:
telnet localhost 80
POST example.php HTTP/1.0
Host: localhost
Content-Type: text/html; charset=iso-8859-1
Content-Length: 11
Name=myname
但它不起作用...有什么帮助吗?
curl http://localhost/example.php -d 'Name=myname'
- deceze