Page 530 - Beginning PHP 5.3
P. 530

Part III: Using PHP in Practice
                   Many response headers are similar, or identical, to their request header counterparts. Here are a few of
                 the more common response headers sent by Web servers:



                     Header          Description                   Example
                       Date            The date and time of the       Date: Mon, 05 Jan 2009 10:07:20
                                   response.                     GMT

                      Content          The length (in bytes) of the       Content - Length: 8704
                          -
                     Length        content that follows.
                       Content - Type           The MIME content type for the      Content - Type: text/html
                                   content that follows.
                       Location           An alternative URL to the one       Location: http://www.example.com/
                                   requested. Commonly used      newpage.php


                                   with 301 and 302 status codes to
                                   send the browser to a new URL.
                       Server        Information about the Web       Server: Apache/1.3.34 (Debian)
                                   server, such as its type and   PHP/5.2.0 - 8+etch13 mod_perl/1.29
                                   version.
                       Set - Cookie       Requests that an HTTP cookie       Set - Cookie: name=Fred;
                                   be stored in the browser.     expires=Mon, 05 - Jan - 2009
                                                                 10:22:21 GMT; path=/; domain=.
                                                                 example.com


                   Here ’ s an example response from a Web server after a browser has requested an HTML page:
                    HTTP/1.x 200 OK
                    Date: Mon, 05 Jan 2009 10:19:52 GMT
                    Server: Apache/2.0.59 (Unix) PHP/5.2.5 DAV/2
                    X-Powered-By: PHP/5.2.5
                    Content-Length: 395
                    Keep-Alive: timeout=15, max=96
                    Connection: Keep-Alive
                    Content-Type: text/html

                      < !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
                     “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd” >
                      < html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en” >
                       < head >
                         < title > About Us < /title >
                         < link rel=”stylesheet” type=”text/css” href=”common.css” / >
                       < /head >
                       < body >
                         < h1 > About Us < /h1 >
                         < p > We specialize in widgets for all occasions. < /p >
                       < /body >
                      < /html >



              492





                                                                                                      9/21/09   9:15:37 AM
          c16.indd   492                                                                              9/21/09   9:15:37 AM
          c16.indd   492
   525   526   527   528   529   530   531   532   533   534   535