Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a script where I'm reading I'm reading a line from a file in a folder that contains multiple lines and trying to then read a proxy address from a file and use it to look up the line which is a URL. It looks like I'm getting multiple proxy addressed back and I can't tell if they're being used for the look up.
Also with my chomp $row I'm trying to return just use lines that start with http. I"m working on that next. Here's my code. I'll continue to trouble shoot but would appreciate any guidance or assistance.
make_path('Bing/1Parsed/Html3/'); while (my $row = <$FILE>) { open my $fh1, ">", "Bing/1Parsed/Html3/$file.html" or die("Cou +ld not open file. $!"); chomp $row; print "$row\n"; my $xml1 = $row; $fh1->print ($row); #add pause my ( $x, $y ) = ( 2, 5 ); my $result = int( rand( $y - $x + 1 ) ) + +$x; print "pausing "; print $result; print "seconds"; sleep ($result); # create useragent my $ua = LWP::UserAgent->new; $ua->agent('Mozilla/8.0'); # Use this UA/Proxy to fetch something.... $ua->proxy(['http'], 'http://'.$proxy); my $xml2 = get $xml1; #$fh1->print ($xml1); $fh1->print ("\n"); #$fh1->print ($fh1.$xml2); #$fh1->print ($fh1); print $xml2; $fh1->print ($xml2); #close $fh1, ">", "Ask/Parsed/Html/$file.h +tml"; close $fh1; $xml2=1; }}
Thanks in advance for any assistance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reading a proxy address from a file and using in a while statement
by Athanasius (Archbishop) on Feb 10, 2016 at 07:49 UTC | |
|
Re: reading a proxy address from a file and using in a while statement
by NetWallah (Canon) on Feb 10, 2016 at 06:44 UTC | |
by Anonymous Monk on Feb 10, 2016 at 07:29 UTC |