Jump to content

reading the entire header


nickmagus

Recommended Posts

Do you mean with PHP for futher processing or just an external application to view it?

 

Live HTTP Headers add-on for Firefox for example...

 

https://addons.mozilla.org/en-US/firefox/addon/3829

 

EDIT: From reading a couple of minutes my understanding is that all header values can be found in the $_SERVER superglobal array...

http://dk2.php.net/manual/pl/reserved.variables.server.php

"To send a header with header()" and "i want to read the header somehow" is not the same and not related...

 

What headers do you want to read?

 

There is a a request header and response header for each and every "component" a given page is comprised of. So there is a request/response header for every image, every style sheet, every .js-file ect. So below is one out of 50-100 total header pairs needed for viewing http://www.phpfreaks.com/forums/

 

http://www.phpfreaks.com/forums/

 

GET /forums/ HTTP/1.1

Host: www.phpfreaks.com

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Cookie: SMFCookie931=a%3A4%3A%7Bi%3A0%3Bs%3A5%3A%2240367%22%3Bi%3A1%3Bs%3A40%3A%2233f6e445ba965d4893b920d41744cc0debeeb1b3%22%3Bi%3A2%3Bi%3A1401746233%3Bi%3A3%3Bi%3A1%3B%7D; __utma=29981182.929747650489728800.1212493546.1217725239.1217756687.176; __utmz=29981182.1212493546.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); phpfreaks_session=5c0vfq84esd5rf77ojogtqond7; fbbb_=3326512757.1.1216050876451; PHPSESSID=thm8iltis57vd2k72p9j1d7t37; __utmb=29981182.4.10.1217756687; __utmc=29981182

If-Modified-Since: Sun, 03 Aug 2008 09:44:45 GMT

 

HTTP/1.x 200 OK

Date: Sun, 03 Aug 2008 09:46:38 GMT

Server: Apache/2.2.8 (EL)

Expires: Mon, 26 Jul 1997 05:00:00 GMT

Cache-Control: private

Pragma: no-cache

Connection: close

Content-Type: text/html; charset=ISO-8859-1

Transfer-Encoding: chunked

 

 

function getCurrentURL()
                {
                        Global $_SERVER;
                        
                        $php_request_uri = htmlentities(substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], "\n\r")), ENT_QUOTES);
                        if(isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == "on"))
                        {
                                $protocol = "https://";
                        }
                        else
                        {
                                $protocol = "http://";
                        }
                        $host = $_SERVER['HTTP_HOST'];
                        if($_SERVER['HTTP_PORT'] != "" && (($protocol == "http://" && $_SERVER['HTTP_PORT'] =! "80") || ($protocol == "https//" && $_SERVER['HTTP_PORT'] =! "443")))
                        {
                                $port = ":" . $_SERVER['HTTP_PORT'];
                        }
                        else
                        {
                                $port = "";
                        }
                        return $protocol . $host . $port . $php_request_uri;
                }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.