rachard11 has asked for the wisdom of the Perl Monks concerning the following question:
Why does the following code result in the error message: "Error GETing http://www.securities.stanford.edu/filings-case.html?id=100992: Can't connect to www.securities.stanford.edu:80 (Bad hostname) at (reference to the last line in the code below)? Based on related posts, this problem should either be fixable by modifying the code below or by adjusting my connection (DNS) settings in my computer, but I've not been able to figure out the solution exactly. I'm using Windows 7, Chrome is my default browser, I can successfully ping securities.stanford.edu from the command prompt.
#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize ; my $mech = WWW::Mechanize->new(); foreach my $line (100982..106146) { next if 0.99 > rand ; print "Now processing $line \n" ; my $get_file = "http://www.securities.stanford.edu/filings-case.ht +ml?id=".$line; my $filename = "file_".$line ; open OUT, ">$filename" or die $!; print "file $filename \n"; $mech->get($get_file) ;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to resolve bad hostname error message
by haukex (Archbishop) on May 02, 2017 at 16:51 UTC | |
by rachard11 (Acolyte) on May 02, 2017 at 18:03 UTC | |
Re: How to resolve bad hostname error message
by kennethk (Abbot) on May 02, 2017 at 16:52 UTC | |
by rachard11 (Acolyte) on May 02, 2017 at 18:12 UTC | |
Re: How to resolve bad hostname error message
by huck (Prior) on May 02, 2017 at 16:52 UTC |
Back to
Seekers of Perl Wisdom