cURL or Client URL is a great tool to acess different protocols programmatically or simply on command line. Over 90% of the websites on the internet are using SSL to protect themselves form unauthorized interception. Its so happens if a SSL enabled websites is access via cURL it simply cannot fetch it and following type of error messages are thrown like:
curl failed to verify the legitimacy of the server and therefore could not connect to it
or
curl: (60) SSL certificate problem: self signed certificate in certificate chain.
To bypass these type of SSL error and access the resource we need to bypass SSL certification verification.
cURL SSL Bypass on Terminal
This is valid for both Windows and Linux cURL installations.
curl -k https://www.tutorialjinni.com/
# or
curl --insecure https://www.tutorialjinni.com/
cURL SSL Bypass in PHP
$cURLHandle= curl_init();
curl_setopt($cURLHandle, CURLOPT_URL,"https://www.tutorialjinni.com/");
curl_setopt($cURLHandle, CURLOPT_RETURNTRANSFER,true);
curl_setopt($cURLHandle, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($cURLHandle, CURLOPT_SSL_VERIFYPEER, FALSE);
$html = curl_exec($cURLHandle);
echo $html;