I just improved this to be even better. Doing a google search I found this function at
http://www.namepros.com/programming/53456-parse-a-url-php-return-domain.html.
<?php
$myurl = "http: //www . thesite . com";
function parse_url_domain ($url) {
$parsed = parse_url($url);
$hostname = $parsed['host'];
return $hostname;
}
$raw_url = parse_url($myurl);
$domain_only =str_replace ('www.','', $raw_url);
$theurl = "http: //www. mysite.com/s/a.cfm?aver=" . $domain_only['host'];
echo file_get_contents($theurl);
?>
I can get $myurl to equal the domain of the site using a wordpress function. And on the coldfusion side all I have to do is run the url variable aver through a switch case statement to get the correct ad for that site. Or could place the ads in a database and do a simple sql request. Either way this is going to make updating ads very, very easy.
<edit: URL munged by Perk>