Page 1 of 1

Apache Log files

Posted: Thu May 08, 2003 4:43 am
by Nunners
I'm trying to create my own log files, equivalent to the Apache ones using PHP.

I need to create the format:
62.161.78.75 - - [dd/mmm/yyyy:hh:mm:ss +0000] "GET / HTTP/1.1" 200 1234 "http://www.from.com/from.html" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
So far I've got this:

Code: Select all

echo($_SERVERї"REMOTE_ADDR"]." - - ї".DATE("d/M/Y:h:m:s +O")."] "".$_SERVERї"REQUEST_METHOD"]." / ".$_SERVERї"SERVER_PROTOCOL"]."" 200 1234 "http://".$_SERVERї"SERVER_NAME"]."".$_SERVERї"SCRIPT_NAME"]."" "".$_ENVї"HTTP_USER_AGENT"].""");
The only two values I'm missing are 200 (the Status Code) and 1234 (the size of the object returned to the client). Is there anyway of getting these variables from PHP? Please help!

Thanks
Nunners