HTTP client methods used on the web to transfer web pages and other documents. There are two popular HTTP methods - GET and POST.
HTTP client methods, the get and post http method, the GET method, the POST method, http protocol
HTTP Client Methods - GET and POSTGo to HTTP Client Methods - GET and POSTBasicsGo to BasicsHomepage

HTTP Client Methods - GET and POST

There are three commonly used HTTP methods

  • GET
  • POST
  • HEAD

The GET method

The GET method is used to retrieve HTML documents from the server. It is a part of the request line from the client and tells the server to pass a copy of the document back to the browser or run a CGI program.

GET is also used to send user information from an HTML form. Through this, the data is sent as a part of the URL in 'name-value' pairs.
The HTML code for a simple form would look something like this:

<FORM NAME="myform" ACTION="cgi-bin/validate.cgi" METHOD="GET">
First Name: <INPUT TYPE="TEXT" NAME="fname" SIZE="20"><BR>
Last Name: <INPUT TYPE="TEXT" NAME="lname" SIZE="20"> <BR>
<INPUT TYPE="SUBMIT" VALUE="SUBMIT">
</FORM>

And this will be displayed in the browser as:

First Name:
Last Name:

Note: Submit button does not work here!

Now, let us suppose your name is John Doe. When you submit this form, the data is attached to the URL in name-value pairs. Each name-value pair is demarcated by a '&' sign and the data is separated from the actual URL with a '?' sign. Thus after submission the URL in the address/location bar of the browser will be as:

www.sitename/cgi-bin/validate.cgi?fname=John&lname=Doe

Note how the ? and & sign separate the URL from the data and the name-value pairs, respectively.

You can also call CGI programs by supplying data with the URL in an HTML link like:

<A HREF="http://www.somesite.com/cgi-program.cgi?name1
=value1&name2=value2&gt;Link to somesite</A>

which shows up as:

Link to somesite

If you move your mouse over this link, you will be able to see the URL and the attached data in the status bar of your browser.

The Post Method

Data from the POST method is sent by the client as a part of the request body. The server receives this data and sends it to a CGI program along with other variables. The METHOD attribute inside the <FORM> tag will carry POST as its value. The big advantage in using POST over GET is that the data is not open to prying eyes. Also, via GET, you can transfer only a limited amount of data; POST exerts no such limitations.

The Head METHOD

This method is used to find information about a document located on the server not retrieve it. It is very similar to the GET method except no data is returned by the server.


AddThis Social Bookmark Button


Page contents: A brief on HTTP client methods especially GET and POST and how they are used to transfer files and web pages over the web.

Page URL: http://www.webdevelopersnotes.com/basics/ http_client_methods_get_post.php3



Join Mailing List


Feedback/Questions




50+ web hosting FAQs

Search engine for your website

Free software from Google - The Google Pack Collection

Create your own search engine
Search WebDevelopersNotes.com