我正在使用cURL连接SSL服务器来接收和发送XML文件,但是当我尝试连接到服务器时,我不断收到“连接()超时!”的提示。由于我对cURL不太熟悉,因此我不知道是服务器配置出了问题,还是证书有问题,或者其他原因。以下是服务器所有者提供给我的代码:
function post($url, $post)
{
$ch = curl_init();
if($ch)
{
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
curl_setopt($ch, CURLOPT_VERBOSE,0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
echo '<pre>', curl_error($ch);
curl_close($ch);
if(!empty($result))
return $result;
}
}
cURL版本信息:
[version_number] => 463362
[age] => 3
[features] => 1597
[ssl_version_number] => 0
[version] => 7.18.2
[host] => i486-pc-linux-gnu
[ssl_version] => OpenSSL/0.9.8g
[libz_version] => 1.2.3.3
[protocols] => Array
(
[0] => tftp
[1] => ftp
[2] => telnet
[3] => dict
[4] => ldap
[5] => ldaps
[6] => http
[7] => file
[8] => https
[9] => ftps
[10] => scp
[11] => sftp
)
-v
的curl命令,看看效果如何。 - troelsknCURL_CONNECTTIMEOUT
选项吗? - Charles Sprayberry