Hello all: I am having a hard time with a small piece of code. I was wondering if someone may be able to explain why the following code will not work... I have been scratching my head for a few hours now and I am stumped.
<?php
header("Location: http://someplace.com");
if( ! headers_sent()) header("Location: http://somplaceelse.com");
?>
So I would expect this piece of code to direct me to somplace.com. However it does not, and I always end up at somplaceelse.com.
I have done a tcpdump to assist with debugging here is the output below. From the look of it the first header is getting ignored all toghether. Is there some way to force changes I made to the headers, that will make headers_sent return TRUE?
Thanks,
-James
---
GET /tracking/test.php HTTP/1.1
Host: dev.www.someplace.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Cookie: toolkitAccess=1
HTTP/1.1 302 Found
Date: Wed, 23 Jul 2003 10:04:55 GMT
Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1 mod_perl/1.27
X-Powered-By: PHP/4.3.1
Location: http://someplaceelse.com
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
---
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php