Dear Perl Monks,

Would some kind soul please tell me how I can duplicate

curl --header 'Host: dl.emsisoft.com' https://www.emsisoft.com/en/software/eek --

with LWP::UserAgent?

Many thanks,
-T

What I have so far
sub GetWebPageWithReferer ( $$$$ ) { # Return $Url's web page my $IAm = ( caller(0) )[3]; # Incoming: my $Url = $_[0]; my $Caller = "$_[1]" . "$IAm"; my $Referer = $_[3]; # headers or referers # Outgoing: my $PageStatus = \$_[2]; $$PageStatus = 0; my $ua; my $response; my $WebPage; $ua = LWP::UserAgent->new; $ua->timeout ( MaxTime1 ); $ua->show_progress; # 0 = do not show; 1 = show # It aint working yet !!! $response = $ua->get( $Url ); # $response = $ua->get( $Url, 'Referer' => "$Referer" ); # $response = $ua->get( $Url, 'Host' => "$Referer" ); $WebPage = $response->content; # print STDERR "$WebPage\n"; if ( ! $response->is_success ) { $$PageStatus = DOWNLOAD_FAIL; print STDERR BOLD RED " ERROR ${Caller}.GetWebPageWithReferer: unable to read " +, $Url, RESET, "\n"; return ""; } else { return $WebPage; } } my $IAm = MyName ( ( caller(0) )[3] ); my $WebSite = "https://www.emsisoft.com/en/software/eek"; my $Referer = "dl.emsisoft.com"; $WebPage = GetWebPageWithReferer ( "$WebSite", $IAm, $PageStatus, "$Re +ferer" );

In reply to Need LWP::UserAgent --header help 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.