0

Here is my code:

my $lwpcurl = LWP::Curl->new(CURLOPT_SSL_VERIFYHOST => 0,CURLOPT_SSL_VERIFYPEER=>0);
my $content;
$content = $lwpcurl->get($url);

I am getting this error:

`SSL peer certificate was not ok`
chrsblck
  • 3,948
  • 2
  • 17
  • 20
Miqdad Ali
  • 6,129
  • 7
  • 31
  • 50

1 Answers1

1

LWP::Curl doesn't accept CURLOPT_SSL_VERIFYHOST/CURLOPT_SSL_VERIFYPEER parameters for it's constructor!

Use LWP::Protocol::Net::Curl instead:

use LWP::Protocol::Net::Curl ssl_verifyhost => 0, ssl_verifypeer => 0;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
my $content = $ua->get($url);

Note that LWP::Protocol::Net::Curl alters the default LWP::UserAgent behavior, so you still use $ua = LWP::UserAgent->new, while it uses libcurl internally.

creaktive
  • 5,193
  • 2
  • 18
  • 32