<?php
// JsAdServer.php Copyright(c) 2013 by Phillip S. Smith Enterprises
// ok to use but include my copyright notice in code.
$htmlcontent=file_get_contents($url);
// you may also use curl or any other method to populate $htmlcontent
$jsContent=$htmlcontent;
$jsContent=preg_replace('/>\s+</','><',$jsContent);
$jsContent=str_replace("<hr />",'',$jsContent);// remove if hr's required
$jsContent=str_replace(chr(13),'',$jsContent);
$jsContent=str_replace(chr(10),'',$jsContent);
$jsContent=str_replace("'","\'",$jsContent);
$jsContent=str_replace('a href="','a target="new" rel="nofollow" href="',$jsContent);
print "document.write('$jsContent');";
?>