Here is the php that will get the name of the domain who your visitor is referred from $_SERVER[‘HTTP_REFERER’]; but itwill display the full address path http://therefferingsite.com
Here is how you can format it to be www.thereferringsite.com and if you are using it from one of your own sites you can ever get cute and do a rewrite in the .htaccess file to format the domain the way you want and then display it. I did this for another of my websites to insert the referring domain without the www (since I used the htaccess rewrite!) and use the same text for the rest of the page it worked great…
anyway here is the code
<? $referringurl = $_SERVER[‘HTTP_REFERER’];
$urlvariable = “$referringurl”;
$ref = parse_url($urlvariable);?>here is how I displayed is
<a href=”<? echo ‘<span style=”text-transform:capitalize;”>’. $ref[‘host’] . ‘</span>’ . ‘/contact.php’ ?>
Wow this excites me I must be a Huge Dork!