HTTP Methods GET vs POST

HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. GET and POST are two different types of HTTP requests . If the method is not specified in the html form GET will be used by default.


GET method places name value pairs as plain text in URL. GET requests are often cached by default by some browsers if you are not careful. It can send but the parameter data is limited to what we can stuff into the request line (URL). Safest to use less than 2K of parameters, some servers handle up to 64K. Also, GET is less secure compared to POST because data sent is part of the URL. So it's saved in browser history and server logs in plaintext . Finally, GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.


POST requests supply additional data from the client (browser) to the server in the message body. It submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both. In the case of security, POST is a little safer than GET because the parameters are not stored in browser history or in web server logs. POST method variables are not displayed in the URL and cannot be cached. With POST you can also do multipart mime encoding which means you can attach files as well. Also if you are using post variables across navigation of pages, the user will get a warning asking if they want to resubmit the post parameter.