Stupid Perl/Apache Question
    Brian Chabot 
    brian at datasquire.net
       
    Thu Dec  7 13:57:41 EST 2006
    
    
  
I'm trying to use a perl script to scrape a site under https.
Using perl-WWW-Mechanize-1.20-1mdv2007.0 from RPM.
perl-Apache-Test-1.28-2mdv2007.0
apache-base-2.2.3-1mdv2007.0
apache-mod_perl-2.0.2-8mdv2007.0
The script parses fine till it goes to scrape the page...
The line that's failing is:
        $mech->get( $URL );
...where $URL is an HTTPS address with basic auth.  I tried using
$auth = MIME::Base64::encode("$adminuser:$adminpass") || die "Error: $!\n";
$mech->add_header (Authorization=>"Basic $auth") || die "Error: $!\n";
and
my @args = (
     Authorization => "Basic " .
           MIME::Base64::encode( $adminuser . ':' . $adminpass )
);
and even putting the username and password in the URL.
I have IO::Socket::SSL and Crypt::SSLeay both loaded.
Yet I keep seeing this error when I run the script from the browser:
Error GETing https://path/to/me/called/script: Can't connect to
host.domain.tld:443 (Illegal seek) at /var/www/cgi-bin/myscript.cgi line
168, referer: http://host.domain.tld/cgi-bin/myscript.cgi
Line 168 is simply:
        $mech->get( $URL, @args );
or
        $mech->get( $URL );
It worked on another machine just fine... but that other machine is dead.
Anyone see anything I might be doing wrong here?  The documentation for
Mechanize could be a lot better.
Thanks!
Brian
    
    
More information about the gnhlug-discuss
mailing list