i wrote this in couple of hours. i havent really begun to develope it yet. it works, but i'm sure there's probably better/safer/faster ways to do certain parts. would anyone like to point out a few?
<?php /*PROXY.PHP************************************\ * Check to see if a web address is present... * * iproxy is where the imagaes are loaded * * myproxy is the addres of the proxy php page * \************************************************/ if(isset($_GET['web'])) { $web = $_GET['web']; $iproxy = '/image.php?image='; $myproxy = 'http://www.domain.com/proxy.php?web='; /************************************************\ * opens the remote page for reading and loads it * * into alltext * \************************************************/ $fd = fopen($web,"r"); while ($line = fgets($fd,1024)) { $alltext.=$line; } fclose ($fd); /************************************************\ * removes current web address from the images * \************************************************/ $alltext = ereg_replace('<img src="'.$web, '<img src="', $alltext); /************************************************\ * strips the address down to its root unless it * * already is * \************************************************/ $web1 = dirname ($web); if($web1 !== "http:") { $web = $web1; } /************************************************\ * removes current web address from the images, * * background and url images, and links * * checks for all variants of img src... * * then prints it out onto the screen. * \************************************************/ $alltext = ereg_replace('<img src="'.$web, '<img src="', $alltext); $alltext = ereg_replace('<img src= "', '<img src="', $alltext); $alltext = ereg_replace('<img src ="', '<img src="', $alltext); $alltext = ereg_replace('<img src = "', '<img src="', $alltext); $alltext = ereg_replace('<img src="', '<img src="'.$iproxy.$web.'/', $alltext); $alltext = ereg_replace('<a href="/'.$web, '<a href="', $alltext); $alltext = ereg_replace('<a href="/', '<a href="', $alltext); $alltext = ereg_replace('<a href="', '<a href="'.$myproxy.$web.'/', $alltext); $alltext = ereg_replace('url\(', 'url('.$iproxy.$web.'/', $alltext); $alltext = ereg_replace('background="', 'background="'.$iproxy.$web.'/', $alltext); echo $alltext; } ?> <?php /*IMAGE.PHP*************************************\ * gets the image name an location from proxy.php * * loads the image as image.php for proxy to call * \************************************************/ $img = $_GET['image']; $fd=fopen("$img","rb"); while ($line=fgets($fd,4096)) { $alltext.=$line; } fclose ($fd); echo $alltext; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php