Page 1 of 1

mass proxy checker

Posted: Thu Sep 20, 2007 6:19 am
by johnwayne77
i am trying to figure out how to create a script that does the following:

it reads a list of proxies from a .txt file let's say (in the following format: ip:port)

then, in a loop, it connects each one of them, one by one, and at least have the option to surf a page (e.g. http://www.yahoo.com) and maybe give back a result (ok or error)..

any ideas?

Posted: Thu Sep 20, 2007 8:00 am
by maliskoleather
something like parse_ini_file() might be of intrest.

Posted: Thu Sep 20, 2007 8:03 am
by johnwayne77
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i could use something like this:

Code: Select all

include "Snoopy.class.php";
$snoopy= new Snoopy;
$snoopy->proxy_host = "216.133.248.227"; // proxy host to use
$snoopy->proxy_port = "80"; // proxy port to use
$url="http://www.xxx.com/";
$snoopy->fetch($url);
echo $snoopy->results;

but how would i create a loop to get the proxy_host from a .txt file and loop until all lines are exhausted


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Sep 20, 2007 8:13 am
by maliskoleather
if you parse the text file into an array, you'll then be able to loop over it with a foreach statement.


off the top of my head:

Code: Select all

include "Snoopy.class.php";

//load the text file
$fileList =file_get_contents('foo.txt');

//split each line into a separate item
$fileList = explode("\n",$fileList);

//each item gets split into an ip and a port
foreach($fileList as $k=>$v){
    $fileList[$k] = explode(':',$v);
}

foreach($fileList as $info){
    $snoopy= new Snoopy;
    $snoopy->proxy_host = $info[0]; // proxy host to use
    $snoopy->proxy_port = $info[1]; // proxy port to use
    $url="http://www.xxx.com/";
    $snoopy->fetch($url);
    echo $snoopy->results;
}