in reply to Re: Not sure how to use HTTP::Tiny
in thread Not sure how to use HTTP::Tiny
use HTTP::Tiny; my $url = 'https://<my-url>'; my $headers = { Accept => "application/json", 'Content-Type' => "application/json", Authorization => "user:password" }; my $response = HTTP::Tiny->new->get($url, { headers => $headers }); if ($response->{success}) { my $html = $response->{content}; print "$html\n"; } else { print "failure: $response->{status}\n"; } This prints 401
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Not sure how to use HTTP::Tiny
by huck (Prior) on May 21, 2018 at 18:18 UTC | |
by plx (Initiate) on May 21, 2018 at 19:57 UTC | |
by poj (Abbot) on May 21, 2018 at 20:50 UTC | |
by huck (Prior) on May 21, 2018 at 21:01 UTC | |
by plx (Initiate) on May 21, 2018 at 21:52 UTC | |
Re^3: Not sure how to use HTTP::Tiny
by Corion (Patriarch) on May 21, 2018 at 17:54 UTC | |
by plx (Initiate) on May 21, 2018 at 19:59 UTC |