I have extreme difficulty with PHP curl. I try to open the site: https://www.novaprostaffing.com/np/index.jsp via PHP curl, but it continues to lead to the following error: "Unknown SSL protocol error due to www.novaprostaffing.com"
My function is this:
function getUrl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $buffer = curl_exec($ch); if (!$buffer) { echo "cURL error number:" .curl_errno($ch); echo " and url is $url and cURL error:" . curl_error($ch); } curl_close($ch); return $buffer;
}
I tried to make several fixes, including:
- Forcing curls to version 3
- Setting CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST to 0
- Checking for curls 7.34. I was told that there is an error in this version, but I am on curl 7.19.1.
None of this has been done. If you have an idea how to fix this, it would be very helpful!
source share