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) ;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|