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?
mass proxy checker
Moderator: General Moderators
- maliskoleather
- Forum Contributor
- Posts: 155
- Joined: Tue May 15, 2007 2:19 am
- Contact:
something like parse_ini_file() might be of intrest.
-
johnwayne77
- Forum Newbie
- Posts: 2
- Joined: Thu Sep 20, 2007 6:04 am
feyd | Please use
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]
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]- maliskoleather
- Forum Contributor
- Posts: 155
- Joined: Tue May 15, 2007 2:19 am
- Contact:
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:
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;
}