HTTP methods: GET POST Comparison

The two most common HTTP methods: GET and POST.

What is HTTP?

Hypertext Transfer Protocol (HTTP) is designed to ensure the communication between the client and the server.

HTTP works by requests between clients and servers - response protocol.

web browser may be the client, and network applications on the computer may also be used as the server.

Example: the client (browser) to submit an HTTP request to the server; the server returns the response to the client. The response contains status information about the request and the content may be requested.

Two kinds of HTTP request methods: GET and POST

Between the client and the server request - response to the two most commonly used methods are: GET and POST.

  • GET - request data from the specified resource.
  • POST - submission of data to be processed to the designated resources

GET Method

Please note that the query string (name / value pairs) are sent in the URL GET request:


GET requests about some of the other comments:

  • GET request can be cached
  • GET request remains in the browser history
  • GET requests can be bookmarked
  • GET requests should not be used when dealing with sensitive data
  • GET requests have length restrictions
  • GET requests should only be used to retrieve data

POST method

Please note that the query string (name / value pairs) are sent in an HTTP POST request message body of:

POST /test/demo_form.asp HTTP/1.1

POST requests about some of the other comments:

  • POST requests are not cached
  • POST requests are not retained in the browser history
  • POST can not be bookmarked
  • POST requests for data length does not require

Comparison GET and POST

The following table compares the two HTTP methods: GET and POST.

Back button / refresh harmless Data will be re-submitted (the browser should inform the user data will be re-submitted).
Bookmarks Can be bookmarked Can not be bookmarked
Caching Be cached You can not cache
Encoding type application / x-www-form-urlencoded application / x-www-form-urlencoded or multipart / form-data. Use of multiple encoded binary data.
history Parameter remains in the browser history. Parameters are not saved in the browser history.
Restrictions on the length of the data Yes. When transmitting data, GET method add data to the URL; URL length is limited (maximum length of the URL is 2048 characters). Unlimited.
Restrictions on data types Only ASCII characters are allowed. unlimited. Also allows binary data.

Compared with the POST, GET is less secure, because the transmitted data is part of the URL.

When sending passwords or other sensitive information should never be used GET!

POST is more secure than GET, because the parameters are not saved in the browser history or web server logs.
Visibility Data in the URL is visible to everyone. Data does not appear in the URL.

Other HTTP request methods

The following table lists some of the other HTTP request methods:

method description
HEAD And GET the same, but returns only the HTTP header does not return the document body.
PUT Upload the specified URI representation.
DELETE Delete the specified resource.
OPTIONS Returns server supports HTTP methods.
CONNECT The request is connected to the transparent conversion of TCP / IP channel.