Useful HTTP Headers


In addition to the selection of $_SERVER variables in Table 6-1, a number of HTTP headers are built into the $_SERVER array as well. These are sent by the browser, and they contain information primarily about the browser.

For example, $_SERVER['HTTP_USER_AGENT'] holds the type of the user's browser, and we're going to put that information to use in the next chunk. You can see the HTTP headers that are accessible by your script using the $_SERVER array in Table 6-2.

NOTE

The $HTTP_SERVER_VARS array contains the same information as shown in Tables 6-1 and 6-2 but is not a superglobal.


These headers are great for learning more about the user's browser, such as what languages it can deal with, what character sets the browser can handle, and more. The most important piece of data here is the browser type, 'HTTP_USER_AGENT', and we'll put that to work in the next chunk.



    Spring Into PHP 5
    Spring Into PHP 5
    ISBN: 0131498622
    EAN: 2147483647
    Year: 2006
    Pages: 254

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net