What is the difference between get and post?
What is the difference between get and post?
HTTP requests of the POST type usually provide additional information from the client (browser) to the server within the message body. GET requests, on the other hand, include all the required or necessary information within the URL (uniform resource locator).
GET | POST | |
Record | The parameters remain in the browser’s history. This is because they are part of the URL. | The parameters are not saved in the browser history. |
BookMark | Accepts Bookmark | On the contrary, POST does not accept bookmarks. |
Behavior with the undo and redo command | Requests are re-executed, however, many cannot be forwarded to the server (only if HTML is still stored in the browser’s cache). | Generally, in POST, the browser alerts the user that the data needs to be forwarded before executing the action. |
Type of encoding (enctype attribute) | Application: x-www-form-urlencoded. | Multipart (for binary data) or form or application: x-www-form-urlencoded. |
Parameters | You can send parameters. However, the size of these is limited only to those that fit within the request message (URL). | You can send parameters, even if necessary, you can upload files to the server. |
Hacks | It is easy to hack, even for a script kiddie or novice. | While it is not impossible, it is harder to hack than GET. |
Are there restrictions on the types of forms? | Yes. GET only allows characters from the ASCII code. | Unlike GET, POST has no restrictions. It also allows data in binary code. |
Security | GET tends to be less secure than POST, because the data sent is part of the URL. The data is stored in the browser history and in the server logs. | POST is usually safer than GET. This is because the parameters are not stored in the browser’s history or when logging in to a web server. |
Restrictions on the length of forms | Yes. This is because the forms are placed in the URL and the length of the URL is restricted. An example of a secure URL length is around 2048 characters, however this depends on the browser and the web server. | There are no restrictions as to the length of the forms in POST. |
Use | Speaking of the GET method, in theory this should not be used when sending passwords or sensitive information. | On the other hand, the POST method can be used without major problem when sending forms that contain sensitive information, such as passwords. |
Visibilidad | The GET method is visible to everyone (it is located in the address bar of the browser). This presents limits as to the information that will be sent. | The variables of the POST method cannot be displayed in the URL. |
Cache (storage) | It can be stored in the cache. | It cannot be hidden in the cache. |