Tuesday, 19 March 2013
Http Response And Its Message Format
The Http Response :
Response |
When a client sends an Http Request to a server then Http Response is a response sent back to client from server.
Actually this article is in connected 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 And Http Response are Http protocol. For understanding it you must know that What is Http Protocol And Its Role In Client Server RelationShip ? This Protocol works in two ways. One is Http Request And the other is Http Response. Check Http Request to know about it.
Actually this article is in connected 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 And Http Response are Http protocol. For understanding it you must know that What is Http Protocol And Its Role In Client Server RelationShip ? This Protocol works in two ways. One is Http Request And the other is Http Response. Check Http Request to know about it.
Http Response Parts :
HTTP Response consists of three parts.
- Response Line
- Header
- Body
Example Of Http Response
HTTP / 1.1 200 Ok
Date: Sat, 31st Oct 2012. 18:10:05 GMT
Server: Apache/ 1.3.12 (UNIX) (SUSE/Linux) PHP/4.0.2
Last-modified: 29th Oct 2012. 14:09:04 GMT
1). The Http Response Line :
Response Line Consists of two informations
- Version : Version Number Of Http
- Http Request Code : It is a code that reports whether the request has passed or failed
Consider this example of Http Response Line
HTTP/1.1200 Ok
Http Request Code:
In the above line 200 is the code. It means that request is successful and Http Response has the required data or page which is sent by the server. If response line code is 404, then it means error. 404 means that the requested page or data cannot be found by server and as a result a error page will be displayed on the browser (Error 404: Page Not Found)
There are also some other codes
Http Request Code Types | |
Code Class | Code Description |
100-199 | It means Request is still processing |
200-299 | It means Server has successfully processed the request |
400-499 | When a request Fails, this code class occurs |
500-599 | It means that the request was right But the server was unable to carry out it |
2). The Response Header :
It is almost similar like HTTP Request Header.
Parts Of Response Header :
It has been divided into three parts
- General: It has information about client and server
- Entity: This part contains the data information which is exchanged between server and client
- Response: It contains the information based on server response
Example
Date: Sat, 31st Oct 2012. 18:10:05 GMT /* The general Header */
Server: Apache/ 1.3.12 (UNIX) (SUSE/Linux) PHP/4.0.2 /* The Response Header */
Last-modified: 29th Oct 2012. 14:09:04 GMT/* The Entity Header */
In the first line general Header is shown which shows the time and date. In the second the Response Header is shown which provides server information. In the third line Entity Header is shown which shows the time of last modification in the page
The Response Body:
If a request is successful then response body sends HTML code and client side scripts back to the browser after rendering. If the request is failed then server sends an error back to the client
Run Php script with HTTP Request :
It is not necessary that client will always be a web browser. Every client that can send Http request can run php program on server. If a correct and proper formatted request is send to a server and the sent Request identifies the proper php file on server with php extension then it can run the php program.
Http response tutorial in urdu |
Http response tutorial in urdu |
php response tutorial in urdu |
Share It |
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:
Client/Server Computer Science PHP Programming Tricks and Tutorials Web Development
Subscribe to:
Post Comments (Atom)
That's a nice informative post Asim, I really loved it
ReplyDeletekeep it up
Thanks Nishant for commenting out here. Its an honour for me . Keep visiting bro
ReplyDelete