Loading lesson path
Concept visual
Start at both ends
The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.
Formula
HTTP works as a request - response protocol between a client and server.Example: A client (browser) sends an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content.
GET POST PUT HEAD DELETE PATCH OPTIONS CONNECT
The two most common HTTP methods are: GET and POST.
GET is used to request data from a specified resource. Note that the query string (name/value pairs) is sent in the URL of a GET request:
Formula
/test/demo_form.php?name1 = value1&name2 = value2GET requests should never be used when dealing with sensitive data
GET requests are only used to request data (not modify)
Formula
POST is used to send data to a server to create/update a resource.The data sent to the server with POST is stored in the request body of the
Formula
POST /test/demo_form.php HTTP/1.1
Host: w3schools.com name1 = value1&name2 = value2POST requests do not remain in the browser history
POST requests have no restrictions on data length Compare GET vs. POST The following table compares the two HTTP methods: GET and POST.
Formula
Data will be re - submitted (the browser should alert the user that the data are about to be re - submitted)Encoding type application/x-www-form-urlencoded application/x-www-form-urlencoded or multipart/form-data. Use multipart encoding for binary data