function acceptAgreement(windowRef, part){ var doc = windowRef.document; disableDownloadAnchors(doc, false, part); hideAgreementDiv(doc, part); writeSessionCookie( 'oraclelicense', 'accept-securebackup-cookie' ); } #### #!/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-windows-i586.exe # Notes: # This is going in a sub. Do not use "die" # The "echo" of this will be read by a Bash script. All debug # statements need to use STDERR # Known mistakes: the multimeg download need to go to a file # not a variable # cookies are not being transfered correctly # http://www.perlmonks.org/?node_id=456612 # http://lwp.interglacial.com/ch11_01.htm use strict; use warnings; use diagnostics; # use diagnostics "-verbose"; 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-b15/jre-7u80-windows-i586.exe"; my $RevAddr = "http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html"; $ua = LWP::UserAgent->new; $ua->cookie_jar ( {} ); $request = HTTP::Request->new('GET', "$RevAddr" ); print "\$request = ", $request -> as_string, "\n"; $response = $ua->simple_request($request); # print "\$response = ", $response -> as_string, "\n"; $cookie_jar->extract_cookies($response); $ua->timeout ( MaxTime3 ); $ua->show_progress ( 1 ); $response = $ua->get ( $ClickHere, ':content_file' => './eraseme.bin' ); print "\$ClickHere response = ", $response -> as_string, "\n";