HTTP Request Methods: GET, POST

GET Method


 
 

HTML source

<html>
<head>
<title>Sample Form -- GET Method</title>
</head>
<body bgcolor="white">

<form method="get" action="/login.html">
<pre>
User name <input name="username" size="20"/>
Password  <input type="password" name="password" size="20"/>
</pre>
<input type="submit"/>
</form>

</body>
</html>

Request sent to the server

GET /login.html?username=Xiaoping+Jia&password=abcdefg HTTP/1.0
Referer: http://localhost:8001/form-get.html
Connection: Keep-Alive
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)
Host: localhost:8001
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8

POST Method



 

HTTP source

<html>
<head>
<title>Sample Form -- POST Method</title>
</head>
<body bgcolor="white">

<form method="post" action="/login.html">
<pre>
User name <input name="username" size="20"/>
Password  <input type="password" name="password" size="20"/>
</pre>
<input type="submit"/>
</form>

</body>
</html>

Request sent to the server

POST /login.html HTTP/1.0
Referer: http://localhost:8001/form-post.html
Connection: Keep-Alive
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)
Host: localhost:8001
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
Content-type: application/x-www-form-urlencoded
Content-length: 38

username=Xiaoping+Jia&password=abcdefg