Home > Web Front-end > JS Tutorial > Explanation on http method and http code

Explanation on http method and http code

Patricia Arquette
Release: 2025-01-30 02:32:08
Original
740 people have browsed it

Explanation on http method and http code

In -depth understanding of the HTTP method and status code.

http method

    Definition:
  • HTTP method (also known as "verb") is like the operation that you can perform resources (such as web pages, images or data) on the Internet. They tell the server what do you want to perform the resource.

    Main method:
  • Get: Used to request data from the specified resource. Take it as a reading information.

      Example: When you type the URL in the browser, it uses Get to retrieve the webpage.
      • Post:
      • Used to send data to the server to create or update resources. Take it as a submission of a form or upload file.
      Example: When you fill in the contact form and click "Submit", it uses Post to send your information to the server.
    • Put:
        Use data sent in the request to replace existing resources.
      • Example: Suppose you are updating your personal information on the social media website; PUT will be used to replace the old pictures with new pictures.
    • Delete: Used to delete the specified resource.
      • Example: When you delete the post on the forum, delete is used to delete it from the server.
      • http status code
    Definition:
  • HTTP status code is a three -digit number. After the request is issued, the server sends it back to the client (such as your network browser). They indicate whether the request is successful and if it fails, it will explain the reason.

Category:

  • 1xx (informatia): The request has been received and continues.

    2xx (Success):
  • The request has been successfully received, understood and accepted.
  • 200 ok: The most common situation, indicating the success of the request.

    • 3xx (redirect): You need to further operate to complete the request.
    • 301 Moved Permanently:
    • Resources have moved to the new URL. 302 Found:
        Resources are temporarily found in different URLs.
      • 4xx (client error):
      The request contains the error syntax or cannot be completed.
    • 404 Not Found: The server cannot find the resource of the request (for example, the webpage that does not exist).
      • 5xx (server error): The server fails to complete the obvious effective request.
      • 500 Internet Server Error: General error message, indicate that there are problems with the server side.
    • importance
        • For users: Status code can help you understand whether there are errors when you browse the web. For example, 404 error tells you that the page you want to find does not exist.
        • For developers:
        • Status code is very important for debugging and checking WEB applications errors. They provide valuable information about the cause of the request. For SEO:
        • Search engine uses status code to understand the status of the webpage. For example, 301 redirect the new URL that the search engine page has been permanently moved.
        • In short,

        Imagine that you order in the restaurant:

        HTTP method:

        Just like your order (for example, "I want to order a Italian carbon Nala").

          HTTP status code:
        • Just like the reply from the waiter (for example, "this is your Italian noodle carbon Nara"-200 ok, or "I'm sorry, we don't have this"-404 Not Found).
        • If you want to learn more about any specific HTTP method or status code, please tell me!

The above is the detailed content of Explanation on http method and http code. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template