PDA

View Full Version : [PHP] Random Proxy Website



ZAG
16-02-2007, 09:01 PM
OK so this is a script that gets a URL and goes to a random proxy site.

Example
http://www.thomas.uk.to/proxy/proxy.php?url=www.habbo.co.uk

There are two files, proxy.php and database.txt

Database.txt is where the list of proxies is. Heres whats in mine:



http://www.proxygen.info/cgiproxy/nph-proxy.pl/010110A/http/<URL>/
http://www.restfull.info/v2/index.php?q=<URL>&hl=0
http://www.bbrowse.com/nph-maths.pl/000010A/http/<URL>/
Note that in the URL's theres a certain code: <URL>
The PHP replaces <URL> with teh given URL and goes to it.

Heres the proxy.php



<?php
function proxy($urlget){
$urlget = eregi_replace("http://", "", $urlget);
$url = urldecode($urlget);

$database = fopen("database.txt", "rb");

while(!feof($database)){
$line = fgets($database);
$data[] .= $line;
}

$lastline = count($data) - 1;

$random = rand(0, $lastline);
$randomproxy = $data[$random];

$proxy = eregi_replace('<URL>', $url, $randomproxy);

header("Location: $proxy");

fclose($database);

}
?>
You would use it like this:



<?php
include('proxy.php);
proxy("www.habbo.co.uk");
?>
Proxies can be added to the database, you just need the URL of a page.

E.g.

http://myproxy.com/proxy/index.php?q=www.website.com

you would put

http://myproxy.com/proxy/index.php?q=<URL>

in the database.txt file.

If you do not understand, reply or PM me.

Mr.OSH
16-02-2007, 09:18 PM
Thats quite good I like it + rep :D

ZAG
16-02-2007, 09:21 PM
Well I thought it could be useful.

Mentor
16-02-2007, 10:13 PM
Well my first trial of your exsample gave a page telling me that the proxie site blocked remote requests hence didnt work to well o.0 Also i dont see why you would want this as opposed to just chooseing a proxie and useing it, since that way you know which ones have been blocked and which havent, makeing it less luck of the draw.

Also as opposed to messing around with a while loop, why not just use the file command to do all that for you?

$database = fopen("database.txt", "rb");

while(!feof($database)){
$line = fgets($database);
$data[] .= $line;
}
==

$data = file("database.txt");

ZAG
16-02-2007, 10:59 PM
Well my first trial of your exsample gave a page telling me that the proxie site blocked remote requests hence didnt work to well o.0
Well the example proxies are ones I've just found looking around the forum.



Also i dont see why you would want this as opposed to just chooseing a proxie and useing it, since that way you know which ones have been blocked and which havent, makeing it less luck of the draw.

Because picking out of a big database would give you more chance to find an unblocked one. Because the single one might be blocked.



Also as opposed to messing around with a while loop, why not just use the file command to do all that for you?

Thanks :)

Want to hide these adverts? Register an account for free!