Ask a Question related to PERL Miscellaneous, Design and Development.
-
Zeke Koos #1
different proxies and multiple requests in LWP::Parallel
I've written the following script to verify a list of proxies in a
seperate file. It works fine except that I can't get LWP::Parallel to
use different proxies for each request. As it is now when I call
$ua->wait(20), the last proxy in list is used for every request in the
queue. If anyone has a solution please help me out here.
thanks
Koos
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use LWP::Parallel::UserAgent;
open(IN, './proxies.txt') or die "Could not open filename:";
my @proxies = <IN>;
chomp @proxies;
close(IN);
print "Content-type: text/html\n\n";
print "Start test:<br />";
my $ua = LWP::Parallel::UserAgent->new();
for (my $i = 0; $i < @proxies; $i++) {
tt("http://192.168.0.1/",$proxies[$i]);
};
my $entries = $ua->wait(20);
foreach (keys %$entries) {
my $res = $entries->{$_}->response;
print "Answer for '",$res->request->url, "' was \t", $res->code,":
",
$res->message,"\n<br />";
}
print "end";
sub tt {
my ($url,$proxy) = @_;
$ua->max_hosts(25);
$ua->agent('Mozilla/4.5');
$ua->proxy('http', 'http://'.$proxy);
my $req = HTTP::Request->new('GET', $url);
$ua->register ($req);
}
Zeke Koos Guest
-
Flash blocking multiple server requests
Hi! The problem is this: if you have an open conection with the server, like, for example, streaming a mp3/flv, Flash simply ignores any other... -
IIS handling multiple requests for the same ASP
<% Response.buffer = true Dim a a = 0 while a < 1000 Response.write "Im Looping" Response.flush a = a+1 wend -
How to use different proxies for LWP::Parallel requests
How do I use a different proxy for each request when using LWP::Parallel ? I use the following subroutine to register the requests, but when I... -
multiple find requests in a link -- impossible?
Mark Bowron wrote: ... -
Multiple Requests (windows)
My web application will open a popup that, upon a user action, will initiate a request that will result in a file being sent as an attachment to the...



Reply With Quote

