Re: How can one find out what Headers have been sent by a script.

From: Date: Thu, 18 Sep 2003 14:26:57 +0000
Subject: Re: How can one find out what Headers have been sent by a script.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-163006@lists.php.net to get a copy of this message
I have found something that seems to work: <?php header('Location: woof.html'); $h = apache_response_headers(); if(isset($h['Location'])){ header('Location: moo.html'); } die(); ?> Typical i get stuck on something for ages and then as soon as i post to the list i figure something out :) oh well hope it helps somebody else. :) On Thursday 18 September 2003 15:10, William Bailey wrote: > Hello all, > > Does anybody know of a way that i can check to see if a header has already > been sent by a script? > > I am currently finishing a class that has a few functions registered with > register_shutdown_function(). They take care of database updates and > general clean up for that object and i want to be able to perform a > different action depending on if, for example, a 'Location:' header has > been sent. > > Is there any way i can get a list of headers already sent from a script? > > I know i could write a custom myHeader() type function that stores the > sent headers in a variable and then read it back but i want something that > i can add to my class and not have to make any changes to other scripts. > The class im currently working on is just supposed to be dropped in and is > then expected to run without the need to update anything else. > > Thanks in advance. > > -- > Regards, > William Bailey. > Pro-Net Internet Services Ltd. > http://www.pro-net.co.uk/ -- Regards, William Bailey. Pro-Net Internet Services Ltd. http://www.pro-net.co.uk/

« previous php.general (#163006) next »