POST
is used when web apps need to transfer files or move the user parameters from the URL.
GET
places user parameters within the URL. POST
places user parameters within the HTTP Request body.
By placing user parameters within the HTTP Request body, there are benefits.
- Lack of logging. POST request sometimes transfer large files so it would be stupid to have log all files as part of the requested URL.
- Less Encoding Requirement. POST request places data in body which can accept binary data. The only characters that need to be encoded are those that are used to separate parameters.
- More data can be sent. URL can’t be too long (below 2000 characters).
Login Forms
PHP login forms typically uses POST requests
Authenticated Cookies
After we successfully authenticate, we are given a cookie value so our browser can persist authentication.
We can set cookie headers instead as such: