Page 529 - Beginning PHP 5.3
P. 529
Chapter 16: PHP and the Outside World
As with requests, a response typically contains up to four sections:
❑ The status line: This tells the Web browser the status of the request
❑ A list of HTTP headers: These optional headers contain extra information about the response,
such as the type and length of the returned content
❑ An empty line: This is required after the request line and any headers
❑ An optional message body: Usually this contains the returned content, such as the Web page
markup or encoded image data
An HTTP status line consists of a status code and a corresponding reason phrase (that is, a plain English
version of the status code). Common status codes include:
Status Code Reason Phrase Description
200 OK The browser ’ s request was successful. The
requested content (if any) will follow.
301 Moved Permanently The requested resource is now at a different URL.
The new URL will follow in a Location header.
The browser should use the new URL in the
future.
302 Found The requested resource is temporarily at a
different URL. The new URL will follow in a
Location header. The browser should continue
to use the existing URL in future requests.
400 Bad Request The request sent by the browser was invalid
(for example, its syntax was incorrect).
403 Forbidden The browser is trying to access a resource that it
does not have permission to access (for example,
a password - protected file).
404 Not Found The resource requested by the browser could not
be found on the server.
500 Internal Server Error There was a problem processing the request on
the server.
491
9/21/09 9:15:36 AM
c16.indd 491 9/21/09 9:15:36 AM
c16.indd 491