NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Anonymous Proxy with PHP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-06-2005, 05:08 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



Anonymous Proxy with PHP


i was wondering if any of you know how to make a browser-type script in php using frames, iframes, or includes that uses an anonymous proxy

something like BypassIt.com, i saw they use PHP

if not php, possibly cgi or something else?

i just want to know the script that can be put in, i can make the rest
r22pl is offline  
Old 03-06-2005, 08:14 PM   #2 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



Read the remote URL in from the query string. Get the remote URL into a variable If your using PHP you probably wget in the toolbox. That's what I usually use. (I've used the MS xmlhtml thing as well, and plain old sockets). This is where you set your agent, referrer, etc.

Then create a list of substitutions that need to be done. Regexs make this particularly painless. For example, you might want to replace “http://” with “http://yoursite/proxy.php?”, insert “/proxy.php?” into relative links, etc.

Now write out the variable. There's not much more to it than that.
primacomputer is offline  
Old 03-07-2005, 04:58 AM   #3 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

PHP Code:
<?php
$user 
"xxxxxx";
$pass "xxxxxxx";


// Tango with the user input
$luser $_COOKIE['user'];
$lpass $_COOKIE['pass'];

if(!
$luser|!$lpass) {
    
$luser $_POST['user'];
    
$lpass $_POST['pass'];
    
setcookie('user'$luser);
    
setcookie('pass'$lpass);
    if(!
$luser|!$pass) {
        echo 
"<form method='post'><input type='text' name='user'><br><input type='password' name='pass'><br><input type='submit' value='auth!'></form>";
????: NamePros.com http://www.namepros.com/programming/73698-anonymous-proxy-with-php.html
        exit;
        }
    }

// Authenticate
if(($user != $luser)|($pass != $lpass)) {
    
setcookie('user');
    
setcookie('pass');
    die(
'wrong pass and shit');
    }

// Do we have an url?
if(!$_GET['url']) {
    echo 
"<form><input type='text' name='url' value='http://'><input type='submit' value='Gogo!'></form>";
    exit;
    }

// Do some initialization, fetching
$url urldecode($_GET['url']);
$url_bits parse_url($url);
// For rewriting
$host $url_bits['host'];
$path $url_bits['path'];
// Since some web browsers actually support spaces in urls, there are some
// websites that have them as well (edge forums :). Let's be graceful about
// those. no reason to comply with the rfcs, is there?
$url str_replace(' ''%20'$url);

// only http requests
if($url_bits['scheme'] != 'http')
    die(
"HTTP only. For now at least.");

// Get the web resource
if(($connection = @fopen($url'r')) === FALSE) {
    die(
"404 or similar. page can't be opened");
    }
$content '';
while (!
feof($connection))
    
$content .= fread($connection8192);

// Get content-type from headers
foreach($http_response_header as $header)
    
ereg('content-type: ([^;]*)'strtolower($header), $regs);
$ctype $regs[1];

// If it should prove to be neccessary, do some content-type guessing with mime
// magic shit or file name.. doesnt look to important since most servers always
// specify content-type.

fclose($connection);

// Rewrite 'href=', 'src=', 'action='
if($ctype == 'text/html') {
????: NamePros.com http://www.namepros.com/showthread.php?t=73698
    
// This obviously isn't very elegant.. will be cutting the conent
    // and doing rewriting piece by piece
    
$pose 0;
    
$pos 0;
    
$content_rewritten '';
    
// Find a new tag
    
while(($pos strpos($content'<'$pose)) !== FALSE) {
        
// Add everything between this and the last tag
        
$content_rewritten .= substr($content$pose$pos $pose);
        
// Get content of this tag
        
$pose strpos($content'>'$pos);
        
$cont substr($content$pos$pose $pos);
        
        
// Find possible urls and rewrite them
        
$link '';
        
eregi('(((href)|(src)|(action)) ?= ?[\'"]?)([^\'" >]*)'$cont$link);
        if(
$link[1])
            
$cont ereg_replace($link[1] . slashreg($link[6]), $link[1] . rewrite($link[6]), $cont);
            
        
// Write the tag to the content
        
$content_rewritten .= $cont;
        
$pos $pose;
        }
    
// Write the end of content and make it actual
    
$content_rewritten .= substr($content$pose);
    
$content $content_rewritten;
    }

// Cough it out
echo $content;

// This rewrites the different urls
function rewrite($url) {
    global 
$host$path;
    if(
strtolower(substr($url07)) == 'http://') {
        
$url urlencode($url);
        }
    else if(
strtolower(substr($url011)) == 'javascript:') {
        return 
$url;
        }
    else if(
substr($url01) == '/') {
        
$url urlencode('http://' $host $url);
        }
    else {
        
$url urlencode('http://' $host '/' ereg_replace('/?(.*)/.*''\\1/'$path) . $url);
        }
    
    return 
'http://' $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?url=' $url;
    }

// Slashes some things that **** with ereg_replace
function slashreg($str) {
    return 
str_replace(array("\\","(",")","?"),array("\\\\","\\(","\\)","\\?"), $str);
    }

?>
uses the ip of the server, check the fopen function on how to connect to a proxy and get a website. This also rewrites urls.
axilant is offline  
Old 03-07-2005, 01:43 PM THREAD STARTER               #4 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



do you need to have the username and password in there in order for it to work?

and some websites ive tried came up as errors
Last edited by r22pl; 03-07-2005 at 02:00 PM.
r22pl is offline  
Old 03-07-2005, 02:13 PM   #5 (permalink)
Senior Member
 
Ferman's Avatar
Join Date: Aug 2004
Location: Criticize BUSH at CRITICIZE.TV
Posts: 1,155
Ferman has a spectacular aura aboutFerman has a spectacular aura about
 



is it possible to modify this script to work for ftp:// https:// urls ? jmarshall s cgiproxy does it but i need a php one
Ferman is offline  
Old 03-07-2005, 02:43 PM THREAD STARTER               #6 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



im looking for one with like frames or something
r22pl is offline  
Old 03-07-2005, 06:49 PM   #7 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

Originally Posted by r22pl
im looking for one with like frames or something
i dont think that would work without a downloaded program?
axilant is offline  
Old 03-07-2005, 07:08 PM THREAD STARTER               #8 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



oh ok, well i'll try the one you posted earlier tomorrow in school
r22pl is offline  
Old 03-07-2005, 10:29 PM   #9 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



If you have to frame it why not frame the original page that posts to the script? After the form is posted the results of the script will display inside the frame.
primacomputer is offline  
Old 03-08-2005, 04:49 AM THREAD STARTER               #10 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



ok thanks
r22pl is offline  
Old 03-08-2005, 12:53 PM   #11 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

why do you need something like this? If you can explain the use, i can help you a little bit more.
axilant is offline  
Old 03-08-2005, 01:04 PM   #12 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



i think there is a php application called snoopy, try sf.net and look for it, i know i saw it
stscac is offline  
Old 03-08-2005, 01:07 PM   #13 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

Originally Posted by stscac
i think there is a php application called snoopy, try sf.net and look for it, i know i saw it
Well snoopy is mainly for connecting to a proxy and then pulling information such as whois

Originally Posted by axilant
Well snoopy is mainly for connecting to a proxy and then pulling information such as whois
nope i was wrong forgive me,
????: NamePros.com http://www.namepros.com/showthread.php?t=73698

http://sourceforge.net/projects/snoopy/
axilant is offline  
Old 03-08-2005, 01:46 PM THREAD STARTER               #14 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



in my internet class at school, i need to make something that you can browse with anonymous proxy. something similar to www.bypassit.com or www.proxify.com, but i dont need all those options. just an input box
r22pl is offline  
Old 03-08-2005, 01:54 PM   #15 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

so basicly your asking someone to do your homework? :-/
axilant is offline  
Old 03-08-2005, 02:16 PM THREAD STARTER               #16 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



no its not homework, its for the teacher, she needs to use it and asked our class to see if we could get one, because all the other ones were blocked by our internet filter
r22pl is offline  
Old 03-08-2005, 07:58 PM   #17 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



Teach wants to surf porn on the job eh?
primacomputer is offline  
Old 03-08-2005, 08:18 PM THREAD STARTER               #18 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



haha i hope not
r22pl is offline  
Old 03-11-2005, 10:30 AM   #19 (permalink)
NamePros Member
Join Date: Oct 2004
Location: New York
Posts: 75
redking is an unknown quantity at this point
 



Originally Posted by r22pl
no its not homework, its for the teacher, she needs to use it and asked our class to see if we could get one, because all the other ones were blocked by our internet filter
I think you're asking someone to do your homework. I'm sure a teacher for an "internet class" could find such a program herself.
redking is offline  
Old 03-11-2005, 03:03 PM THREAD STARTER               #20 (permalink)
NamePros Member
Join Date: Mar 2005
Location: York, PA
Posts: 39
r22pl is an unknown quantity at this point
 



no, im not. and besides, i figured it out myself
r22pl is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 12:35 PM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 10:09 AM
Free Anonymous Proxy Browser Spondoo Free Resources 4 03-16-2005 01:18 PM
Proxy Detection in php axilant CODE 1 06-25-2004 06:24 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 10:04 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger