in reply to Re^3: Can't call method "proxy" on an undefined value at
in thread Can't call method "proxy" on an undefined value at
Thanks. I see my error. I've modified the code and I can pull the proxy from the list but I'm getting the following error, "Proxy must be specified as absolute URI; '1.0.251.108:8080' is not at" with the code below:
open(my $fh, '<', 'cities.txt') or die $!; print $fh; open(my $prx, '<', 'proxies.txt') or die $!; print $prx; mkdir 'Bing', 0755; mkdir 'Bing/1Parsed/', 0755; mkdir 'Bing/1Parsed/Html/', 0755; chomp(my @cities = <$fh>); close($fh); chomp(my @prx = <$prx>); print $prx; close($prx); open($fh, '<', 'keywords.txt') or die $!; for my $city (@cities) { seek($fh, 0, 0); while (my $keywords = <$fh>) { chomp($keywords); print "$city $keywords\n"; my $xml1 = $link1 . $city ."+". $keywords . $link2 . $city ."+". $ +keywords . $link3; #my $xmla = $link3 . $row . ".com"; #my $xmlx = $link4 . $row; my $filename1 = "Bing/".($city)."_". ($keywords) . ".html"; open my $fh1, ">", $filename1 or die("Could not open file. $!"); #toggle proxy selection my $ua = LWP::UserAgent->new; $ua->agent('Mozilla/8.0'); for my $p (@prx){ print "Current proxy:$p\n"; $ua->proxy('http', $p); # Use this UA/Proxy to fetch something.... }
I've read the can LPW info but I can't see how to fix this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Can't call method "proxy" on an undefined value at
by NetWallah (Canon) on Feb 09, 2016 at 06:50 UTC | |
by Anonymous Monk on Feb 09, 2016 at 07:27 UTC | |
by poj (Abbot) on Feb 09, 2016 at 12:20 UTC | |
by Anonymous Monk on Feb 09, 2016 at 14:22 UTC | |
by poj (Abbot) on Feb 09, 2016 at 14:51 UTC | |
|