tags:

views:

53

answers:

4

Is there a way to echo the header information of a webpage, for example:

Server: Microsoft-IIS/7.0

etc....

A: 

There appears to be a nice little script someone wrote for this, complete with all the if/else if/else statements.

Josh K
+2  A: 

Or you can use the PHP function headers_list()

Ivo Sabev
A: 

If you want to see the headers as received by the browser, then use something like LiveHTTPHeaders, FireBug, or HTTPFox. All are for Firefox. Personally I use HTTPFox and Firebug the most.

Server-side, you can use headers_list() as stated earlier, with the proviso it can only show headers that have been set already. If something adds/changes headers later in the script's execution, then you'll be displaying "stale" information.

Marc B
+1  A: 

headers_list() will return the headers of your own webpage in an array. If you want some other servers headers there's a function named get_headers(). To print it you can either var_dump() it or echo in a foreach.

Hultner