What is HTTP?
The Hypertext Transfer Protocol (HTTP) is designed to ensure communication between the client and the server.
HTTP works as a request-response protocol between the client and the server.
A Web browser might be a client, and a network application on a computer might be a server-side.
Example: the client (browser) submits an HTTP request to the server, and the server returns a response to the client. The response contains status information about the request and what might be requested.
Two methods of HTTP request: GET and POST
In the request-response between the client and the server, the two most commonly used methods are: GET and POST.
- GET-Requests data from the specified resource.
- POST-submits the data to be processed to the specified resource
GET method
Note that the query string (name/value pair) is sent in the URL of the GET request:
/test/demo_form.asp?name1=value1&name2=value2
Some additional comments about the GET request:
- Get requests can be cached
- GET requests remain in browser history
- Get requests can be bookmark-Favorites
- GET requests should not be used when handling sensitive data
- Get request has a length limit
- GET requests should only be used to retrieve data
POST method
Note that the query string (name/value pair) is sent in the HTTP message body of the POST request:
Post/test/demo_form.asp http/1.1host:w3schools.comname1=value1&name2=value2
Some additional comments about the POST request:
- POST requests are not cached
- POST requests are not persisted in browser history
- POST cannot be bookmarked
- POST request has no requirement for data length
The post and get submissions for the HTTP protocol.