Monday, 18 March 2013
What Is Http Request And What Are Its Contents ?
The Http Request:
Http Request is a request sent by the browser client to the server communication. This post is in series with the Working Of Online Php Program And RelationShip Of Client And Server. Client and Server communicate with each other with the help of HTTP Protocol.
Http Request is a Http protocol. For understanding it you must know that What is Http Protocol And Its Role In Client Server RelationShip ?
Http Request |
Parts Of The Http Request:
The Http Request message has three parts
- Request line
- Header
- Body
Example Of Http Request:
Let us understand using this example
GET / testpage.htm HTTP / 1.1Accept: */*Accept-Language: en-usConnection: Keep-AliveHost: www.test.comReferer: http://www.test.com/php/users.php?userid=3730User-Agent: Mozilla (X11; I; Linux 2.0.32 i586)
Explaining Different Parts of the Http Request Example :
Now we will explain different parts of the Above Http Request one by one
1).The Request Line :
It is the first part of the Http Request Message. There are three types of informations in first line i-e request line of Http Request
- Method: Http Command which is known as method (like POST or GET)
- Path: Path on server which is requested by the client
- Version: Version of HTTP (like HTTP 1.1)
For Example
GET/testpage.htm HTTP/1.1
Method :
The method tell the web server that how to deal with the request.
In above example we have used GET method.
Types Of Methods
There are also other types of methods which are as follows:
Types Of Methods | |
Name Of Method | Description Of Method |
GET | GET is mostly used on all HTTP Requests used on internet. When we click a link then a GET request is made. Information which is required by the request can be anything e.g. a HTML Page or a PHP page. In this way we can send some limited data to browser. |
POST | In this method, data becomes the part of the HTTP Body and message is sent to the server as a part of the request. You can see on many different websites that they have forms and the data of fields of the form are sent to the server using POST Method. After sending to server it is then transferred to DATA Handler. |
Head | This is just like GET method but the difference is that there is no data is Head Method. Instead it identifies the request for HTTP Header. |
2).The Http Request Header :
It is the Second part of the Http Request Message. It is Information sent on second number to server is Http Header. Http Header has the information that which document types are supported by client so that server can send the supported files back to the client. Browser details of the web browser which has sent request are also in this Http Request header. Along with these Browser type, data and general configurations are also a part of this header.
Categories Of Http Header Information :
Http Header Information can be categorized in three categories.
Categories Of Http Header Information | |
Name | Description |
General | These are the information of the client and server |
Entity | This is the information about the data which will be exchanged between server and client |
Request | This is the information about the client configuration and the document types supported by the client. |
Example of Http Header
Accept: */*Accept-Language: en-usConnection: Keep-AliveHost: www.test.comReferer: http://www.test.com/php/users.php?userid=3730User-Agent: Mozilla (X11; I; Linux 2.0.32 i586)
3).The Http Request Body:
It is the Third part of the Http Request Message. If we have used the POST method then the data which will be sent to the browser will be in HTTP request Body. Like when a user fill s a form and sends it, then The data filled by user will come in HTTP Request Body, else it will be empty.
Author: Mohammad
Mohammad is the founder of STC Network which offers Web Services and Online Business Solutions to clients around the globe. Read More →
Related Posts:
Computer Science Http PHP Tricks and Tutorials Web Development
Subscribe to:
Post Comments (Atom)
0 comments: