HTTP, GET, POST, Response Code

Source: Internet
Author: User

Short description of the HTTP protocol, the difference between get and post requests, and the response code for the request (Response code)HTTP

The browser downloads a Web site (application) from a Web server (or an application server) using the HTTP protocol, which is based on a request-response (Request-response) model. A client (browser) requests data from a Web application running on a physical mechanism, and the Web app responds to the browser's request in turn

It is important to remember that communication is always initiated by the client (browser), and the server (that is, the Web server) has no way to create a connection, send the data to your browser without your request, and if you accept the data from the server, it must be because your browser has sent the request

HTTP GET

The Get method is like it sounds, get (request) data from the Web server, get request is the most common HTTP request so far, and in the process of a GET request, the Web app responds to the HTML of the requested page without doing anything. In particular, Web applications should not change the state of the application in the results of a GET request (for example, you cannot create a new account based on a GET request), that is, the data cannot be maintained, and it is for this reason that get requests are generally considered "safe" because they do not cause the application to change

HTTP POST

Obviously, in addition to the Simple view page, we also need to have more interaction with the site. We can also send data to an app, such as through a form. To achieve this, there is a need for a different type of request method:POST. Post requests usually carry data entered by the user, and the Web app will generate some behavior after you enter your information into a form to log in to a Web site, which is the data for the post submission form.

Unlike get requests, post requests often lead to changes in application state. In our example, when the form is post, a new account is created. Unlike a GET request, a POST request does not always generate a new HTML page to send to the client (browser), but instead the client uses a response code (response code) to determine whether the applied operation succeeded.

HTTP Response Code

Typically, the Web server returns 200 of the response code, meaning "I've done what you asked me to do, everything works." The response code is always a three-digit code name, and the Web application sends a code for each response, indicating the result of the given request. Response 200 is "OK", for post, there will be a "204" such content sent back, meaning "everything is normal, but I do not intend to show you anything." The POST request will still send a special URL, which may be different from the page where the data was submitted, and it is important to be aware of it. Or take our landing as an example, the table when possible on the Www.sth.com/login page, clicking Submit may cause post requests with form data to be sent to the Www.sth.com/logon page. The location of the post request to be sent is specifically marked in the HTML of the form.

HTTP, GET, POST, Response Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.