是否是这样?代码如下: $url="https://apiurl";
$headers=array('Authorization:aaa',"X-API-KEY:bbb");
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$file_contents = curl_exec($ch);//获得返回值
dump($file_contents); 返回的是 false
dump(curl_errno($ch)); 返回的是 60 网上 60 说的是同侪凭证不能与已知的 CA 证书进行身份验证。
dump(curl_error($ch)); 返回的是 SSL certificate problem: self signed certificate in certificate chain
curl_close($ch);
1
fondy8888 2016-05-12 15:09:43 +08:00
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|