Zend - The PHP Company




Miscellaneous

Add Code


Proxy Bypass filter  

Type: application
Added by: angelxmod
Entered: 23/06/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 6343
This script downloads the contents of a site and displays it. Changing all the links.


<html>

<head>

<title>Proxy</title>

</head>

<body>


<form action="<?php echo $_SERVER[PHP_SELF?>" method="GET">

<p><strong>Type In The Address:</strong> <input type="text" name="address" size="80"></p>

<p><input type="submit" value="submit"></p>
    <p> (note that address must be in http://www.domain.com/ format. Yes slash at the end.)<p><br><hr>
</form>

</body>
</html>

<?php
if (!empty($_GET[address])) {
    
$domain $_GET[address];
    
$var strpos($domain'/'8);
    
$count 7;
    while (
$count $var)
    {
            
$dom .= $domain[$count];
            
$count++;
    }

    if(!
$fp=fopen("$_GET[address],"r" )) {
        echo 
" can not open $_GET[address]";
     }
     else {

           while(!
feof($fp)) {

                  
$line fgets($fp1024);

                  
$pos1 strpos($line'href');
                  
$pos2 strpos($line'src');

                  if (
$line[$pos1 6]== '/')
                          
$line str_replace('href="''href="http://' "$_SERVER[HTTP_HOST].  "$_SERVER[PHP_SELF]'?address=' 'http://' "$dom,$line);

                  else if (
$line[$pos1 6]== 'h')
                          
$line str_replace('href="','href="http://' "$_SERVER[HTTP_HOST].  "$_SERVER[PHP_SELF]'?address=' ,$line);
                  else
                           
$line str_replace('href="','href="http://' "$_SERVER[HTTP_HOST].  "$_SERVER[PHP_SELF]'?address=' 'http://' "$dom"/",$line);

                  if (
$line[$pos2+5]=='/')
                        {
                            echo  
str_replace('src="''src="http://' "$_SERVER[HTTP_HOST].  "$_SERVER[PHP_SELF]'?address=' 'http://' "$dom"$line);
                        }

                else if(
$line[$pos2 5]== 'h')
                        {
                     echo 
str_replace('src="''src="http://' "$_SERVER[HTTP_HOST].  "$_SERVER[PHP_SELF]'?address='$line);
                        }
                  else
                        {
                      echo 
str_replace('src="''src="http://' "$_SERVER[HTTP_HOST].  "$_SERVER[PHP_SELF]'?address=' 'http://' "$dom"/"$line);
                        }
           }

           
fclose($fp);


           }
}
?>


Usage Example




Rate This Script





Search



This Category All Categories