How can I get a script to run whenever an http request is made?
I have 2 web servers. One hosts my main website (www.site.com), and the other hosts a subdomain (sub.site.com). The way I have it set up, any time you go to the subdomain, it routes through the main server first, using mod_proxy. On the main web server I have a php script that logs information any time a web page is accessed. What I would like to happen is anytime someone accesses the subdomain, the logging script runs on the main server before sending the request on to the subdomain server. I开发者_C百科s this possible?
How about a cURL request from the subdomain to the main site, passing along all of the request headers?
Could you use a front controller style that redirects every request as needed? Or maybe make a pointcut and attach logging code transparently by using Aspect Oriented Programming?
精彩评论