Dear Monks,

I am still having troubles downloading from Foss Hub. Now I get a timeout. What am I doing wrong now?

My Original post on this was http://www.perlmonks.org/?node_id=1195763

#!/usr/bin/env perl use lib '/home/linuxutil'; use strict; use warnings; # use Net::Nslookup qw ( nslookup ); use LWP::UserAgent; use LWP::Protocol qw ( https ); use Term::ANSIColor qw ( BOLD BLUE RED GREEN RESET ); use Data::Dumper; ( my $WhoAmI = $0 ) =~ s{.*/}{}; use constant MaxTime1 => 20; # Seconds use constant MaxTime2 => 720; # Seconds use constant MaxTime3 => 3300; # Seconds use constant MaxTime4 => 6600; # Seconds use constant UNKNOWN => 0; # 0000b, unknown (default) use constant NO_UPDATE => 1; # 0001b, no update found use constant UPDATE => 2; # 0010b, update found use constant ERROR => 4; # 0100b, error use constant DOWNLOAD_FAIL => 8; # 1000b, unable to download my $FirefoxUserAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko +/20100101 Firefox/52.0'; sub DownloadWebFile ( $$$$$$$$ ) { # Download the $Url's file and return the status my $IAm = ( caller(0) )[3]; # Incoming: my $Caller = "$_[0]" . "$IAm"; my $Host = $_[1]; # "download.fosshub.com"; my $UserAgent = $_[2]; # 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0 +) Gecko/20100101 Firefox/52.0' my $Referer = $_[3]; # "http://usa.kaspersky.com/windows10"; my $Cookies = $_[4]; # 'oraclelicense=accept-securebackup-cooki +e' my $Timeout = $_[5]; my $Url = $_[6]; my $FileName = $_[7]; # File name and path to save the file to # Outgoing: my $PageStatus = ""; $PageStatus = UPDATE; # 2 = good download my $ua; my $response; print "Downloading ", BOLD, BLUE, "$Url\n", RESET, "to ", BOLD, BLUE, "$FileName", RESET, "\n"; $ua = LWP::UserAgent->new; $ua->timeout ( MaxTime1 ); $ua->show_progress ( 1 ); # 0 = do not show; 1 = show $ua->agent('Mozilla/5.0'); $response = $ua->get( $Url, ':content_file' => "$FileName", 'Cookie' => "$Cookies", 'Referer' => "$Referer", 'User-Agent' => "$UserAgent", 'Host' => "$Host" ); # print STDERR "$content\n"; # if ( ! $response->is_success ) { # use Data::Dumper; # print Dumper($response); # ... # } if ( ! $response->is_success ) { $PageStatus = DOWNLOAD_FAIL; print STDERR BOLD RED " ERROR ${Caller}.GetWebPage: unable to read ", $Url, RESET, "\n"; print STDERR BOLD RED Dumper($response), RESET, "\n"; return ""; } } # curl --header 'Host: download.fosshub.com' http://www.fosshub.com/HW +iNFO.html/hw64_554.exe -o eraseme # curl # # --header 'Host: download.fosshub.com' # # --header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko +/20100101 Firefox/52.0' # # --header 'Accept: text/html,application/xhtml+xml,application/xml;q= +0.9,*/*;q=0.8' # # --header 'Accept-Language: en-US,en;q=0.5' # # --header 'Referer: https://www.fosshub.com/HWiNFO.html/hw64_554.exe' + # # --header 'Cookie: __cfduid=daf437999528d9d660b6cffb5aaccb5a214974124 +53' # # --header 'Connection: keep-alive' # # --header 'Upgrade-Insecure-Requests: 1' # # 'https://download.fosshub.com/Protected/expiretime=1500727489;badurl +=aHR0cDovL3d3dy5mb3NzaHViLmNvbS9IV2lORk8uaHRtbA==/d7455c67933d1acd208 +e2b13e4dac1ab6691196a030c95de8a99af4630a91954/HWiNFO/hw64_554.exe' # # -o 'hw64_554.exe' -L # curl --header 'Referer: http://www.hwinfo.com/download.php' 'https: +//www.hwinfo.com/files/hw64_554.exe' -o 'hw64_554.exe' -L my $Status = DownloadWebFile( "HwINFO_Test ", "download.fosshub.com", "$FirefoxUserAgent", "https://www.fosshub.com/HWiNFO.html", "", MaxTime4, "https://www.fosshub.com/HWiNFO.html/hw64_554.exe", "eraseme" );


Many thanks,
-T

In reply to Having troubles downloading from FossHub by Todd Chester
in thread need help downloading a file by Todd Chester

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.