im writing a script that needs to parse $HTTP_referer and get the domain. at the moment it works with any standard www.somedomain.com but if it comes from a subdomain it doesnt work. does anyone know how to do this or if its even possible. thanks in advance for any replies. currently this is the code.
if($HTTP_REFERER){
$url=parse_url(strtolower($HTTP_REFERER));
if (substr($url["host"],0,4)=="www.")
$from=substr($url["host"],4);
else $from=$url["host"];
}
if(!$from)$from='nourl';else
$from=addslashes($from);
echo $url[1];
echo $from;