Loop in Perl - with LWP::UserAgent
Here the code that has needs to be build in loop - to make USER-Agent to iterate over a bunch of targets.
for my $i (1..10000) {
my $request = HTTP::Request->new(GET =>
sprintf("http://www.example.com,%d", $i));
Is this the correct way to iterate? I love to hear from you ... to get a 开发者_如何学编程starting-point...
Just a suggestion, you may want to use WWW::Mechanize
instead, which is a handy sub-class for the LWP::Module. For what you want to do the code could look like this:
foreach my $i (1..1000)
{
#$mech is a object for WWW::Mechanize
$mech->get("http://yourtarget.com/whateveryouwant");
}
Then you can sort the results e.g. by response code (404 - Not Found, 200 - OK...) by checking $mech->status()
精彩评论