use HTTP::Tiny; my $url = 'https://'; 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