我对El Capitan 10.11.4,PHP 7.0.12,CURL 7.50.3的curl请求有问题。当我尝试向https服务发出请求时,我看到错误: 卷曲失败,错误#51:SSL:证书验证失败(结果:5)
你知道我该如何解决它?
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://google.ch');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
if (FALSE === $content)
throw new Exception(curl_error($ch), curl_errno($ch));
} catch(Exception $e) {
trigger_error(sprintf(
'Curl failed with error #%d: %s',
$e->getCode(), $e->getMessage()),
E_USER_ERROR);
}