I know about PhpProxy . But I want to create one small by myself. I am not understanding the codes from PHPProxy. Can anyone plz help me with the idea/logic ?
You get the page from the server, parse certain html tags to fix images / strip scripts etc then echo the html, they are actually very simple
I don't have that much time this afternoon, but this should / could get you started : <? class proxy { static $cache; static $url; function __construct( $url = null, $strip = array( ), $adjust = array( ) ) { if( !$url ) return; self::$url = preg_replace("/\\/$/si", "", $url ); if( !(self::$cache = file_get_contents( self::$url ) ) ): self::$cache = sprintf( "Cannot connect to %s", self::$url ); elseif( !self::parse() ): self::$cache = sprintf( "Cannot parse %s", self::$url ); endif; $form = "<center>". "<form action=\"\" method=\"post\">". "URL : <input type=\"text\" name=\"url\">". "<input type=\"submit\" value=\"Browse\">". "</form>". "</center>\n"; echo preg_replace("#<body (.*?)>#si", "<body $1>" . $form, self::$cache ); } function parse( ) { $clean = self::$cache; $search = "/((src|href|background|action)=\"([^:,^>,^\"]*)\")/i"; preg_match_all( $search, self::$cache, $temp ); $search = array_unique( $temp[3] ); $clean = str_replace("./", self::$url . "//", $clean ); foreach( $search as $makeup ) { if( $makeup != "/" ) $clean = str_replace( $makeup, self::$url . "//$makeup", $clean ); } self::$cache = trim( $clean ); if( self::$cache) return true; } } new proxy( @$_REQUEST['url'] ); ?> PHP: The next step would be to replace all the links with links that go back through the proxy.
Thankz Can I get some sites that can help me to create my php proxy ??? Only Ideas !!! Thankz again for ur great help
That was off the top of my head, if it were me that was making one, I would look at the source of others to see what features I would keep and see what features I would have to make; it shouldn't be too hard if you know php to make a decent lightweight proxy without a tutorial.