<?php $site = 'http://www.google.com/'; echo preg_replace('~\<\/head\>~i',"<base href='{$site}'></head>",file_get_contents($site)); ?>