http 中的post和get方法

在http中可以使用post和get与服务器交流信息。

在html中的实现:

通过post方式提交数据:<form name="test" method="post" action="target.php"> <input name="input1" type="text" value ="nihao"> <input name="input2" type="text" value = "nihuai"> <input type="submit" value="send"> </form>

 

实际发送的信息为

POST / HTTP/1.1
Host: www.****.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)
Gecko/20050225 Firefox/1.0.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 40
Connection: Keep-Alive
     (----此处空一行----)
input1=nihao&input2=nihuai

而通过get方法:
例如:

<form name="test" method="get" action="target.php"> <input name="input1" type="text" value ="nihao"> <input name="input2" type="text" value = "nihuai"> <input type="submit" value="send"> </form>

他发送的信息为

 

GET /target.php ? input1=nihao&input2=nihuai HTTP/1.1
Host: www.***.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)
Gecko/20050225 Firefox/1.0.1
Connection: Keep-Alive

 

因此get的信息会在地址栏显示,而post的数据不会。

若想查看post的信息简单的网络抓报就可以了。

你若使用firefox 可以安装HttpFox 这个插件检测该信息。

 

你可能感兴趣的:(html,windows,服务器,input,action,firefox)