SSL例程:ssl3_read_bytes:tlsv1警报协议版本

时间:2019-10-22 11:07:19

标签: php ssl nginx curl https

我收到此错误: 致命错误:未捕获的异常:error:1409442E:SSL例程:ssl3_read_bytes:tlsv1警报协议版本位于/home/ankurgupta/websites/control.abhinavsoftware.in/imgssl/index.php:26

$fileUrl = "https://demos.abhinavsoftware.com/university/uploads/5d73a80a1d88a.jpg";
$saveTo = "ssl.jpg"; 

$fp = fopen($saveTo, 'w+');
$ch = curl_init($fileUrl); //Create a cURL handle.
curl_setopt($ch, CURLOPT_FILE, $fp); //Pass our file handle to cURL.
curl_setopt($ch, CURLOPT_TIMEOUT, 7); //Timeout if the file doesn't download after 20 seconds.
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);

$response  = curl_exec($ch); //Execute the request.
if(curl_errno($ch)){ //If there was an error, throw an Exception
    throw new Exception(curl_error($ch));
} 


$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); //Get the HTTP status code. 
$errorMessage = curl_error($ch);
$errorCode = curl_errno($ch);

print_r($statusCode);
print_r($errorMessage);
print_r($errorCode);
var_dump($response);

curl_close($ch); //Close the cURL handler.

相同的代码在我的本地服务器(运行Ubuntu 19.04)中工作。但是在我的Web服务器上失败(运行Ubuntu 18.04),同时运行Nginx和PHP7.2 FPM

您能帮我解决问题吗?

0 个答案:

没有答案