RayRay459 has asked for the wisdom of the Perl Monks concerning the following question:
Here is a sample of my input list:#!D:/perl/bin -w use LWP::UserAgent; use HTTP::Request; use HTML::TableExtract; $OutFile = "results.txt"; open(OUT,">>$OutFile") || die "Can't create $OutFile: $!"; open(IN,"ipList1.txt") || die "Can't open ipList1.txt: $!"; OUTER: while(<IN>) { $url = $_; print $url . "\n"; $ua = new LWP::UserAgent; $request = new HTTP::Request('GET',$url); $request->authorization_basic('login', 'password'); $ua->timeout(10); $response = $ua->request($request); $responsecode = $response->code(); print $responsecode . "\n"; INNER: if ($responsecode != 200) { sleep 1; redo OUTER; } else { # login successful, let's get the html code into a variable @ARRAY_OF_LINES = (split "\n", $ua->request($request)->as_stri +ng); foreach $line (@ARRAY_OF_LINES) { $html_code .= $line . "\n"; } } $te = new HTML::TableExtract( depth => 0, count => 1 ); $te->parse($html_code); foreach $ts ($te->table_states) { #print "Table (", join(',', $ts->coords), "):\n"; foreach $row ($ts->rows) { $td = join(" ", @$row); $td =~ s/\n/ /g; if ( $td =~ /^\s*(\d)\s+(\w+)\s+(\d)\s+(\w+)/) { $outlet1 = $1; $host1 = $2; $outlet2 = $3; $host2 = $4; print OUT "Outlet: $outlet1, Host: $host1\n"; print OUT "Outlet: $outlet2, Host: $host2\n\n"; sleep 1; } } } }
And here is my results.txt:http://192.168.10.20/pdumaina http://192.168.10.21/pdumaina
As you can see ...it never gets any info from the second url. I just keeps going over the first URL please help.Outlet: 1, Host: KanaApp1 Outlet: 5, Host: Kyle Outlet: 2, Host: KanaApp2 Outlet: 6, Host: Cres Outlet: 3, Host: Kenny Outlet: 7, Host: Ebb2 Outlet: 4, Host: Eric Outlet: 8, Host: Flood2 Outlet: 1, Host: KanaApp1 Outlet: 5, Host: Kyle Outlet: 2, Host: KanaApp2 Outlet: 6, Host: Cres Outlet: 3, Host: Kenny Outlet: 7, Host: Ebb2 Outlet: 4, Host: Eric Outlet: 8, Host: Flood2 Outlet: 1, Host: KanaApp1 Outlet: 5, Host: Kyle Outlet: 2, Host: KanaApp2 Outlet: 6, Host: Cres Outlet: 3, Host: Kenny Outlet: 7, Host: Ebb2 Outlet: 4, Host: Eric Outlet: 8, Host: Flood2 Outlet: 1, Host: KanaApp1 Outlet: 5, Host: Kyle Outlet: 2, Host: KanaApp2 Outlet: 6, Host: Cres Outlet: 3, Host: Kenny Outlet: 7, Host: Ebb2 Outlet: 4, Host: Eric Outlet: 8, Host: Flood2 Outlet: 1, Host: KanaApp1 Outlet: 5, Host: Kyle Outlet: 2, Host: KanaApp2 Outlet: 6, Host: Cres Outlet: 3, Host: Kenny Outlet: 7, Host: Ebb2 Outlet: 4, Host: Eric Outlet: 8, Host: Flood2 Outlet: 1, Host: KanaApp1 Outlet: 5, Host: Kyle Outlet: 2, Host: KanaApp2 Outlet: 6, Host: Cres Outlet: 3, Host: Kenny Outlet: 7, Host: Ebb2 Outlet: 4, Host: Eric Outlet: 8, Host: Flood2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: my code is erroring out when i have it read its urls from a list
by blakem (Monsignor) on Sep 12, 2001 at 01:47 UTC | |
|
(tye)Re: my code is erroring out when i have it read its urls from a list
by tye (Sage) on Sep 12, 2001 at 02:59 UTC | |
|
Re: my code is erroring out when i have it read its urls from a list
by buckaduck (Chaplain) on Sep 11, 2001 at 23:04 UTC |