This code replaces only links and images:
<? $txt = file_get_contents('http://stats.pingdom.com/qmwwuwoz2b71/522741'); $txt = str_replace(array('href="', 'src="'), array('href="http://stats.pingdom.com/', 'src="http://stats.pingdom.com/'), $txt); echo $txt; ?>
I tested and worked :)
UPDATED
Here the regex is made and works better:
<? $txt = file_get_contents('http://stats.pingdom.com/qmwwuwoz2b71/522741'); $domain = "http://stats.pingdom.com"; $txt = preg_replace("/(href|src)\=\"([^(http)])(\/)?/", "$1=\"$domain$2", $txt); echo $txt; ?>
Done: D
source share