[Project_owners] PHP Not Respecting header()

Douglas E. Warner silfreed at silfreed.net
Tue Dec 18 10:14:07 PST 2007


On Tuesday 18 December 2007, David White wrote:
> Sorry for my newbie questions. But I am stumped again. My php code is
> trying to set the following on a response:
>
> header($_SERVER['SERVER_PROTOCOL'] . " 400 This is mine", true, 400);
>
> I do not want the "default" status text. I really want my own
> information put there. However, I ALWAYS receive "BAD REQUEST" on the
> status line that is returned.
>
> Shouldn't this be possible? If so, how?

You shouldn't need to do all that; for example:
<?php
header("HTTP/1.0 404 Not Found");
?>
(http://php.net/header)

Typically you'll need to exit(); afterward if you don't want your page to 
continue processing afterward.

-Doug

-- 
Douglas E. Warner    <silfreed at silfreed.net>    Site Developer
Mozdev.org           http://www.mozdev.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.mozdev.org/pipermail/project_owners/attachments/20071218/750d805f/attachment.bin 


More information about the Project_owners mailing list