HTTP Request Examples


Married
Male

The form above contains four controls:

The precise HTTP request sent out depends on the enctype and method specifications. The data sent out for the four possible combinations are displayed below:

GET /en/html/dummy.php?name=MyName&married=not+single &male=yes HTTP/1.1
Host: www.explainth.at
User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.explainth.at/en/misc/httpreq.shtml
enctype="application/x-www-form-urlencoded" method="GET"

Note how the form data has been appended to the URL.

POST /en/html/dummy.php HTTP/1.1
Host: www.explainth.at
User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.explainth.at/en/misc/httpreq.shtml
Content-Type: application/x-www-form-urlencoded
Content-Length: 39

name=MyName&married=not+single&male=yes
enctype="application/x-www-form-urlencoded" method="POST"

Points to note

GET /en/html/dummy.php?name=MyName&married=not+single& male=yes HTTP/1.1
Host: www.explainth.at
User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.explainth.at/en/misc/httpreq.shtml?txt=
enctype="multipart/form-data" method="GET"

Note that the multipart/form-data specification was simply ignored by the browser.

POST /en/html/dummy.php HTTP/1.1
Host: www.explainth.at
User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.explainth.at/en/misc/httpreq.shtml?txt=
Content-Type: multipart/form-data; boundary=---------------------------103832778631715
Content-Length: 355

-----------------------------103832778631715
Content-Disposition: form-data; name="name"

MyName
-----------------------------103832778631715
Content-Disposition: form-data; name="married"

not single
-----------------------------103832778631715
Content-Disposition: form-data; name="male"

yes
-----------------------------103832778631715--
enctype="multipart/form-data" method="POST"

Points to note

These examples were captured using FireFox. Although they differ in detail, both Opera and IE yield similar results. If you plan to use these examples to capture HTTP requests in your own custom server be aware that the order of entries in the request header may be different.

Jump To...

Colophon