well I got another one. This one I did for another thread on here and it may have some good use, but I will probably never use it.
It will open a URL and then print it out like it was in the file. The preg_replace() had to be used since the images, styleshheets and things like that wouldn't show up properly.PHP Code:<?
function format($p, $url) {
$p = preg_replace("#(src=\"|SRC=\"|src=|SRC=)(.*?)((\"?))#i", "$1$url/$2$3", $p);
$p = preg_replace("#(<link)(.*?)(href=\"|HREF=\"|HREF=|HREF=)(.*?)((\"?))#i", "$1$2$3$url/$4", $p);
$p = preg_replace("#(<form)(.*?)(action=\"|ACTION=\"|action=|action=)(.*?)((\"?))#i", "$1$2$3$url/$4", $p);
$p = preg_replace("#(<a)(.*?)(href=\"|HREF=\"|HREF=|HREF=)(.*?)((\"?))#i", "$1$2$3$url/$4", $p);
$p = preg_replace("#(background=\"|BACKGROUND=|background=|BACKGROUND=)(.*?)((\"?))#i", "$1$url/$2$3", $p);
return $p;
}
$url = "http://www.example.com";
$uri = "http://www.example.com/index.php";
$fp = fopen($uri, "r");
while (!feof($fp)) {
$line = fgets($fp, 4096);
echo format($line, $url);
}
?>
It doesn't work that well but it gets the job done.





Bookmarks