我现在已经尝试了很多不同的解决方案,但这些卷曲设置都不起作用……我只想把网页的源码拿回来...
是的,我知道有file_get_contents()。但是我需要并且想要使用file_get_contents()的curl实例。错误在哪里?如何使用curl获取网页内容?
$url = "https://google.de";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_HTTPHEADER, array(
// "API-Token: " . APITOKEN . "",
// "API-Secret: " . APISECRET . "",
//));
$response = curl_exec($curl);
echo "This is the response...:\n" . $response;$response始终为空...即使我将变量保存到文本文件中...这张图片证明了这一点!
致以问候和感谢!
发布于 2017-06-28 09:30:03
请转储curl_error($curl)。然后你会得到"SSL certificate problem: unable to get local issuer certificate"。
您只需设置以下选项即可避免此错误:
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);警告:上述解决方案禁用了SSL验证,并且不安全。一个安全的解决方案是设置cURL的认证:
curl_setopt ($curl, CURLOPT_CAINFO, "PATH_TO/cacert.pem");发布于 2017-06-28 10:15:16
If you will check error then you will show below error
if(!curl_exec($curl)){
die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
}
Error: "SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed" - Code: 60
To solve this issue you can follow this link-
https://wehavefaces.net/fixing-ssl-certificate-problem-when-performing-https-requests-in-php-e3b2bb5c58f6https://stackoverflow.com/questions/44792257
复制相似问题