Why do we need to disable SSL check PHP cURL?
When we try to open any website and if it has Security Certificate issue then the browser will show the screen for “Untrusted connection”. In this case, we are clicking on “I Understand the Risks” and adding a website in the exception list. Whenever we will post any data on this URL by cURL, it will not give any response if it has Security Certificate issue. Because of this reason we need to disable SSL check PHP cURL to get a successful response.
We can disable SSL check PHP cURL by this code:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Below is the complete function to get content by cURL.
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return data inplace of echoing on screen
curl_setopt($ch, CURLOPT_URL, $strURL);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Skip SSL Verification
$rsData = curl_exec($ch);
Let me know if need any help in cURL.
Happy Coding 🙂