0% found this document useful (0 votes)
5 views3 pages

HTTP Get

The document explains the HTTP GET and POST methods, detailing their functionalities and differences. GET requests data from a server without changing its state, while POST sends data to create or update resources. Key differences include data size limits, security, and how requests are stored in browser history and cache.

Uploaded by

Emick Ghimire
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)
5 views3 pages

HTTP Get

The document explains the HTTP GET and POST methods, detailing their functionalities and differences. GET requests data from a server without changing its state, while POST sends data to create or update resources. Key differences include data size limits, security, and how requests are stored in browser history and cache.

Uploaded by

Emick Ghimire
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

HTTP GET

The HTTP GET method requests data from a server without altering its state.
<!DOCTYPE html>
<html>
<body>
<form action="[Link]" method="GET">
Username:
<input type="text" name="username" /> <br>
City:
<input type="text" name="city" /> <br>
<input type="submit" />
</form>
</body>
</html>
In the following PHP code using the GET method we have displayed the Username and city.
<!DOCTYPE html>
<html>
<body>
Your Username:
<?php echo $_GET["username"]; ?> </br>
Your City is:
<?php echo $_GET["city"]; ?>
</body>
</html>
HTTP POST
The HTTP POST method sends data from the client to the server to create or update
resources, storing data in the request body.
<!DOCTYPE html>
<html>
<body>
<form action="[Link]" method="post">
Username:
<input type="text" name="username" /> <br>
Area of Study:
<input type="text" name="area" /> <br>
<input type="submit" />
</form>
</body>
</html>
In the following PHP code using the POST method we have displayed the Username and Area
of study.
<!DOCTYPE html>
<html>
<body>
Your UserName:
<?php echo $_POST["username"]; ?> </br>
Your Area of Study is:
<?php echo $_POST["area"]; ?>
</body>

</html>

Difference between HTTP GET and HTTP POST

HTTP GET HTTP POST

In POST method large amount of data can be


In GET method we cannot send large
sent because the request parameter is
amount of data.
appended into the body.

GET request is comparatively better than POST request is comparatively less better
Post so it is used more than the Post than Get method, so it is used less than the
request. Get request.

GET requests are only used to request data POST requests can be used to create and
(not modify) modify data.

GET request is comparatively less secure. POST request is comparatively more secure.

Request made through GET method are Request made through POST method is not
stored in Browser history. stored in Browser history.
HTTP GET HTTP POST

GET method request can be saved as POST method request cannot be saved as
bookmark in browser. bookmark in browser.

Request made through GET method are Request made through POST method are not
stored in cache memory of Browser. stored in cache memory of Browser.

Data passed through GET method can be Data passed through POST method can not
easily stolen by attackers as the data is be easily stolen by attackers as the URL Data
visible to everyone. is not displayed in the URL

In GET method only ASCII characters are


In POST method all types of data is allowed.
allowed.

You might also like