Forum Moderators: coopster

Message Too Old, No Replies

manipulating header codes e.g. 404, 200, 204, 205?

         

fintan

2:54 pm on Aug 24, 2006 (gmt 0)

10+ Year Member



Hi can anyone tell me how to go about change the reponse header codes in php? I've tried

header("HTTP/1.1 204 No Content");
&
header("204 No Content");

Thanks

fintan.

barns101

3:56 pm on Aug 24, 2006 (gmt 0)

10+ Year Member



The first one is how I do my headers:


<?php
header("HTTP/1.1 404 Not Found");
?>

What's the problem?

eelixduppy

4:02 pm on Aug 24, 2006 (gmt 0)




Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

Maybe this is your problem? Good luck!

jatar_k

4:05 pm on Aug 24, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are you getting an error?
how do you know it isn't working?

fintan

4:15 pm on Aug 24, 2006 (gmt 0)

10+ Year Member



Thanks for the replies lads. I was trying to be too smart. I was trying to do to many things at once with ajax. Kind of messed up my logic. So I simplefied it and it works.

I was using the firebug & Live HTTP Headers extensions for firefox to debug.