Standard request method

Currently, HTTP/1.1 specifies eight methods, all of which must be uppercase, so I’ll list them briefly and explain them in more detail later.

  1. GET: Obtain resources, which can be interpreted as reading or downloading data.
  2. HEAD: Obtain the meta information of the resource.
  3. POST: submits data to the resource, which is equivalent to writing or uploading data.
  4. PUT: similar to POST;
  5. DELETE: Deletes resources.
  6. CONNECT: Establish a special connection tunnel;
  7. OPTIONS: Lists the methods that can be implemented on the resource;
  8. TRACE: TRACE the transmission path of the request-response

GET

This means requesting a resource from the server, which can be static text, pages, images, videos, or dynamically generated pages or data in other formats in PHP, Java, or other formats.

HEAD

The HEAD method is similar to the GET method in that it requests the resource from the server. The server processes the request in the same way, but the server does not return the entity data requested, only the response header, which is the “meta information” of the resource.

POST/PUT

The GET and HEAD methods GET data from the server, while the POST and PUT methods do the opposite, submitting data to the resource specified by the URI, and putting the data in the body of the packet.

The function of PUT is similar to that of POST. It can also submit data to the server, but it is slightly different from POST. Generally, POST means “create” or “create”, while PUT means “modify” or “update”.

GET the POST difference

Request parameters: GET request parameters are passed through the URL, multiple parameters are connected with &, and POST requests are placed in the request body. Request caching: GET requests are cached, but POST requests are not unless manually set. Bookmarks: GET requests are supported, POST requests are not. Security: POST is safer than GET. GET requests are harmless when the browser rolls back, while POST requests again. History: GET request parameters are fully preserved in the browsing history, while POST parameters are not. Encoding mode: A GET request can only be encoded by the URL, while a POST request supports multiple encoding modes. For the data type of the argument: GET accepts only ASCII characters, while POST has no restrictions.

The only way to access a resource is to enter a URL in the browser’s address bar as a GET request.

reference

  • How should the request method be understood?
  • Find out the difference between POST and GET requests. Did you GET them this time