卷曲总是返回假 [英] curl always returning false
本文介绍了卷曲总是返回假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码始终回显false.我想念什么吗?
The following code always echos false. Am I missing something?
$url = "https://www.google.nl/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(curl_exec($ch)) {
echo "true";
}else{
echo "false";
}
推荐答案
添加此 cURL
参数.这是因为,Google在安全HTTP上运行.
Add this cURL
param. That is because , Google runs on Secure HTTP.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
这篇关于卷曲总是返回假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文