4

I am consuming API in magento 2 using

\Magento\Framework\HTTP\Client\Curl

Its working with http but not working with https so I am getting following error.

SSL certificate problem: self signed certificate

So how to disable SSL verification using Curl class.

1 Answer 1

9

After research I found the method name setOption in Class

\Magento\Framework\HTTP\Client\Curl

And add following line in my code like this

$curl = new \Magento\Framework\HTTP\Client\Curl;

$curl->setOption(CURLOPT_SSL_VERIFYHOST,false);
$curl->setOption(CURLOPT_SSL_VERIFYPEER,false);

And it works :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.