What\'s the difference when using GET
or POST
method? Which one is more secure? What are (dis)advantages of each of them?
(similar question
GET
and POST
are HTTP methods which can achieve similar goals
GET
is basically for just getting (retrieving) data, A GET
should not have a body, so aside from cookies, the only place to pass info is in the URL and URLs are limited in length , GET
is less secure compared to POST
because data sent is part of the URL
Never use GET
when sending passwords, credit card or other sensitive information!, Data is visible to everyone in the URL, Can be cached data .
GET
is harmless when we are reloading or calling back button, it will be book marked, parameters remain in browser history, only ASCII characters allowed.
POST
may involve anything, like storing or updating data, or ordering a product, or sending e-mail. POST
method has a body.
POST
method is secured for passing sensitive and confidential information to server it will not visible in query parameters in URL and parameters are not saved in browser history. There are no restrictions on data length. When we are reloading the browser should alert the user that the data are about to be re-submitted. POST
method cannot be bookmarked