Reputation: 7483
I want to get and log every request that come to any resource on my domain.
I know how to get it if the requested resource is the php file. and that is by inserting the piece of code that will log the $_REQUEST
information into every php file on my website, and save this information on a file or db..etc.
but I don't know how to know throw PHP if someone requested another resource (e.g: images, js scripts,...etc).
1- Is there a PHP way to know if someone requested other resources than PHP files?
2- Is there a another way to log the requests to my php files better than inserting the logging code into every php file?
Upvotes: 0
Views: 52
Reputation: 2062
You can't do this from PHP if the execution does not go through the logger script. But luckily for you, Apache already saves all the access logs. Just search in the apache2.conf (or httpd.conf) file to see where are the access logs stored.
Upvotes: 2