'HTTP_HOST' not being evaluated correctly ?
I use php scripts when there are errors (like 400,404,403,etc), to email me and advise of what is being attempted.
I noticed on a 400 error, the 'from' and 'to' didn't contain my domain name, but another domain name. This is some of the code I use ..
The var $http_host had the other domain name there. Fortunately, the email bounced back, so I became aware of the problem. Here is the web access logs entry
$http_host = $_SERVER["HTTP_HOST"];
$http_host = str_replace("www.", "", $http_host);
$from = "From: webmaster@" . $http_host . "\r\n";
$to = "From: webmaster@" . $http_host . "\r\n";
It seems $_SERVER["HTTP_HOST"] was evaluated to '24x7-allrequestsallowed.com'
I'm mystified how this was parsed as a URL, but more uneasy that $_SERVER["HTTP_HOST"] wasn't set to the 'proper' domain name.