I have a curl request that goes through fine
curl -k -L -c cookie.txt -b cookie.txt --user administrator:done! --
+header "Content-Type:application/json" --header "Accept:application/j
+son" https://10.244.204.25/api/types/names
The above request works
I get
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
Using LWP
use warnings;
use LWP::UserAgent;
require HTTP::Cookies;
my $ua = new LWP::UserAgent;
$ua->agent('Mozilla/5.0');
$cookie_jar =
HTTP::Cookies->new( file => 'cookies_lwp.txt', autosave => 1
+, ignore_discard => 1 ); # A cookie file is needed to store the secur
+ity keys.
$ua->cookie_jar($cookie_jar);
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
$ua->default_header( "Accept" =>"application/json" );
$ua->default_header( "Content-Type" => "application/json");
my $netloc="10.244.204.25:443";
$ua->credentials( $netloc, 'Security Realm', 'administrator', 'done!')
+;
$ua->ssl_opts( verify_hostnames => 0 ,SSL_verify_mode => 0x00);
my $req = new HTTP::Request('GET','https://10.244.204.25/api/types/nam
+es');
my $res = $ua->request($req);
print $res->code, "\n";
print $res->message;
use Data::Dumper;
This does not work
I get
'_msg' => 'Can\'t connect to 10.244.204.25:443 (certificate verify failed)',
Doesnt $ua->ssl_opts( verify_hostnames => 0 ,SSL_verify_mode => 0x00); do the equivalent of curl -k which is to use insecure connection?