in reply to Re^3: Can't call method "extract_cookies" on an undefined value
in thread Can't call method "extract_cookies" on an undefined value
Editorial comment: the p, /p stuff is a pain in the neck!
YIPPEE!!! I figured it out!
1) Cpan errored out on me when I was trying to install perl-LWP-Protocol-https. Yum did the trick:
# yum install perl-LWP-Protocol-httpsThis gave me no end of trouble.
Perl did not give me an error for
use LWP::Protocol qw ( https );even though it was not there. LWP's "get" gave me the error.
2) one of the "monks" (thank you!) told me how to manually include the stinkin' cookie and what the stinkin' syntax was:
$response = $ua->get( $ClickHere, ':content_file' => './java.exe', 'Cookie' => 'oraclelicense=accept-securebackup-cookie' );
I googled my a** off trying to figure that one out!
3) and I figured out the proper download side for $ClickHere:
# this on is "misdirection" (very funny guys!) # my $ClickHere = "http://download.oracle.com/otn-pub/java/jdk/7u80-b1 +5/jre-7u80-windows-i586.exe"; # This is the real one my $ClickHere = "https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b1 +5/jre-7u80-windows-i586.exe";
Thank you all for your help and support!
-T
#!/usr/bin/perl # Test java wget style download of Java # wget --header "Cookie: # oraclelicense=accept-securebackup-cookie" # http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jre-7u80-window +s-i586.exe # Notes: # This is going in a sub. Do not use "die" # Dependancy (cpan fails here) # yum install perl-LWP-Protocol-https use strict; use warnings; use diagnostics; use Term::ANSIColor qw( BOLD RED RESET ); use LWP::UserAgent; use HTTP::Cookies qw ( extract_cookies ); use LWP::Protocol qw ( https ); use HTTP::Request qw ( request ); use constant MaxTime3 => scalar 3300; # Seconds # Indent here is so I don't have to put it back when it goes back into + a sub my $ua; my $response; my $content; my $request; my $cookie_jar; # my $ClickHere = "http://download.oracle.com/otn-pub/java/jdk/7u80-b1 +5/jre-7u80-windows-i586.exe"; my $ClickHere = "https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b1 +5/jre-7u80-windows-i586.exe"; my $RevAddr = "http://www.oracle.com/technetwork/java/javase/downloads +/jre7-downloads-1880261.html"; $ua = LWP::UserAgent->new; $ua->timeout ( MaxTime3 ); $ua->show_progress ( 1 ); $response = $ua->get( $ClickHere, ':content_file' => './java.exe', 'Cookie' => 'oraclelicense=accept-securebackup-cookie' );
|
|---|