Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Can't connect to https using LWP::UserAgent

by madtoperl (Hermit)
on Feb 08, 2017 at 07:10 UTC ( #1181372=note: print w/replies, xml ) Need Help??

in reply to Can't connect to https using LWP::UserAgent

you can try below if you are not doing SSL validation,
untested though since I do not have permission to install Net::SSL module in my box
use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common qw(GET); use Net::SSL; my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0}, ); my $req = GET ''; my $res = $ua->request($req); if ($res->is_success) { print $res->content; }else{ print $res->status_line . "\n"; }

Replies are listed 'Best First'.
Re^2: Can't connect to https using LWP::UserAgent
by ruqui (Acolyte) on Feb 08, 2017 at 10:24 UTC
    Your solution works for me! Thank you! Do you know why this works when my initial attempt failed? (I'd like to know what I did wrong)
      The key was disabling the verify_hostname option to the https handler. You probably should install Mozilla::CA as per the LWP::Protocol::https documentation so that you can verify the certificates presented by the server.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1181372]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2023-12-11 22:02 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.