0% found this document useful (0 votes)
12 views2 pages

Get&Post Method

The document explains the GET and POST methods of the Hypertext Transfer Protocol (HTTP), which facilitate communication between clients and servers. The GET method requests data and includes it in the URL, making it bookmarkable but less secure, while the POST method submits data in a separate package, offering more security and a larger data limit but cannot be bookmarked. A comparison table highlights key differences between the two methods regarding caching, security, and data visibility.

Uploaded by

SANJEET KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Get&Post Method

The document explains the GET and POST methods of the Hypertext Transfer Protocol (HTTP), which facilitate communication between clients and servers. The GET method requests data and includes it in the URL, making it bookmarkable but less secure, while the POST method submits data in a separate package, offering more security and a larger data limit but cannot be bookmarked. A comparison table highlights key differences between the two methods regarding caching, security, and data visibility.

Uploaded by

SANJEET KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

GET & POST Method

The Hypertext Transfer Protocol (HTTP) is designed to enable communications between


clients and servers. HTTP works as a request-response protocol between a client and server. A
web browser may be the client, and an application on a computer that hosts a website may be
the server. A client (browser) submits an HTTP request to the server; then the server returns a
response to the client. The response contains status information about the request and may
also contain the requested content.
There are 2 HTTP request methods:
 GET: Requests data from a specified resource.
 POST: Submits data to be processed to a specified resource.
We will understand both these methods in detail through the examples.
GET Method: In the GET method, the data is sent as URL parameters that are usually
strings of name and value pairs separated by ampersands (&).
Advantages:
 Since the data sent by the GET method are displayed in the URL, it is possible to
bookmark the page with specific query string values.
 GET requests can be cached and GET requests to remain in the browser history.
 GET requests can be bookmarked.
Disadvantages:
 The GET method is not suitable for passing sensitive information such as the
username and password, because these are fully visible in the URL query string as
well as potentially stored in the client browser’s memory as a visited page.
 Because the GET method assigns data to a server environment variable, the length of
the URL is limited. So, there is a limitation for the total data to be sent.
POST Method: In the POST method, the data is sent to the server as a package in a separate
communication with the processing script. Data sent through the POST method will not be
visible in the URL.
Advantages:
 It is more secure than GET because user-entered information is never visible in the
URL query string or in the server logs.
 There is a much larger limit on the amount of data that can be passed and one can
send text data as well as binary data (uploading a file) using POST.
Disadvantages:
 Since the data sent by the POST method is not visible in the URL, so it is not possible
to bookmark the page with a specific query.
 POST requests are never cached
 POST requests do not remain in the browser history.
Comparison Between GET & POST Method:

GET POST

BACK button/Reload Harmless Data will be re-submitted (the


browser should alert the user that
the data are about to be re-
submitted)
Bookmarked Can be bookmarked Cannot be bookmarked
Cached Can be cached Not cached
Encoding type application/x-www-form- application/x-www-form-
urlencoded urlencoded or multipart/form-data.
Use multipart encoding for binary
data
History Parameters remain in Parameters are not saved in
browser history browser history
Restrictions on data length Yes, when sending data, the No restrictions
GET method adds the data
to the URL; and the length
of a URL is limited
(maximum URL length is
2048 characters)
Restrictions on data type Only ASCII characters No restrictions. Binary data is also
allowed allowed
Security GET is less secure POST is a little safer than GET
compared to POST because because the parameters are not
data sent is part of the URL stored in browser history or in web
server logs
Never use GET when
sending passwords or other
sensitive information!

Visibility Data is visible to everyone Data is not displayed in the URL


in the URL

You might also like