HTML Methodをテストする例

2480 ワード

テスト用コード:
<form method="POST">

    First name: <input type="text" name="fname" />

    Last name: <input type="text" name="lname" />

    <input type="submit" value="Submit" />

</form>

 
GET使用時にサービスに送信されるデータ:
GET /phpsocket/method.php?fname=steven&lname=jobs HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*

Referer: http://localhost/phpsocket/method.php?fname=steven&lname=jobs

Accept-Language: zh-cn

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

Host: localhost

Connection: Keep-Alive

 

POSTT :

POST /phpsocket/method.php HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*

Referer: http://localhost/phpsocket/method.php

Accept-Language: zh-cn

Content-Type: application/x-www-form-urlencoded

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

Host: localhost

Content-Length: 23

Connection: Keep-Alive

Cache-Control: no-cache

Cookie: ZDEDebuggerPresent=php,phtml,php3



fname=steven&lname=jobs

 


1. GET ,POST ;
2. GET QueryString ,POST Content 。