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?


In reply to LWP::UserAgent to ignore ssl certificate by perlbaski

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.