我有一个已经使用了多年的设置(Laravel),但是突然有些变化了,curl_setopt将不再起作用。执行curl后,它将重新运行cURL错误55(无法发送http请求)。
我使用php 5.6。
这是我的卷发设置:
$ch = curl_init();
if (!$ch) {
die("ERROR: cURL initialization failed. Check your cURL/PHP configuration.");
}
// - then set the cURL options; to ignore SSL invalid certificates; set timeouts etc.
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt ($ch, CURLOPT_FAILONERROR, 0);
curl_setopt ($ch, CURLOPT_URL, SERVER_URL);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header); <---This is an array
$this->Response = curl_exec ($ch);
// Check for any connection errors and then close the connection.
$curlError = curl_errno($ch);
$curlErrorText = curl_error($ch);
curl_close($ch);
这是curl_exec()前后的curl_getinfo()输出-相同:
[url] => -------This is an HTTPS link
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[redirect_url] =>
[primary_ip] =>
[certinfo] => Array
(
)
[primary_port] => 0
[local_ip] =>
[local_port] => 0
即使设置了所有内容,为什么信息仍为空。就像我说的那样,这种用法以前起作用。我没有更改服务器上的任何内容。