#!/usr/bin/perl use warnings; use REST::Client; use LWP::UserAgent; use JSON; use MIME::Base64; use Data::Dumper; $ENV{HTTPS_VERSION} = 3; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; ######################################################## # This works in the shell ######################################################## #curl -k 'https://:@/webacs/api/v1/data/Devices' my $host = 'https://'; my $user = ''; my $pwd = ''; my $client = REST::Client->new(host => $host); my $encoded_auth = encode_base64("$user:$pwd", ''); $client->GET("/webacs/api/v1/data/Devices", {'Authorization' => "Basic $encoded_auth", 'Accept' => 'application/json'}); print 'Response: ' . $client->responseContent() . "\n"; print 'Response status: ' . $client->responseCode() . "\n"; foreach ( $client->responseHeaders() ) { print 'Header: ' . $_ . '=' . $client->responseHeader($_) . "\n"; } __END__ Response: Can't connect to :443 LWP::Protocol::https::Socket: SSL connect attempt failed with unknown errorerror:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure at /usr/lib/perl5/site_perl/5.10.0/LWP/Protocol/http.pm line 47. Response status: 500 Header: Content-Type=text/plain Header: Client-Date=Tue, 28 Jun 2016 13:56:58 GMT Header: Client-Warning=Internal response