Forum Moderators: coopster

Message Too Old, No Replies

Sending Apache Headers With PHP

php apache headers

         

hooperleed

9:47 am on Jul 27, 2006 (gmt 0)

10+ Year Member



Hello,

I'm trying to mimic a valid apache reponse from php.

I use modrewrite to send everything to one php script then the first few
lines are:

header("HTTP/1.1 200 OK");

foreach (apache_request_headers() as $key => $value)
{
header("$key: $value");
}
//Wed, 15 Nov 1995 04:58:08 GMT

$mtime=time();
$lm=gmdate('D, d M Y H:i:s', $mtime-3600) . ' GMT';
header("Last-Modified: $lm");

I then go on to server some html.

I'm really flying blind here anyone got any thoughts?

adb64

10:34 am on Jul 27, 2006 (gmt 0)

10+ Year Member



The PHP function apache_request_headers [nl2.php.net] returns an array with the headers as sent by the client browser.
You can not return these headers back. You have to make your own array with all headers you want to send if you want to do it this way.

ahmedtheking

9:32 pm on Jul 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why are you trying to do this?

eeek

10:02 pm on Jul 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why are you trying to do this?

That's exactly what I was thinking. What's wrong with letting Apache handle the headers?