I'm trying to get a website content using curl in PHP.
Here's my code:
$sslVersion = 1;
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSLVERSION, $sslVersion);
//execute post
$response = curl_exec($ch);
//response
echo 'Error: ' . curl_error($ch);
echo PHP_EOL;
//response
echo 'Response: ';
var_dump($response);
echo PHP_EOL;
curl_close($ch);
If I have my SSL version set to 1 I get:
Error: error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1000)
Response: bool(false)
If it's 2 I have:
Error: OpenSSL was built without SSLv2 support
Response: bool(false)
And if it's 3 this happens:
Error: Empty reply from server
Response: bool(false)
Thanks for the help.