开发者

Could not resolve host

This randomly started happening again on my development computer. It works fine on the production server, so whatever. But I still need to test this here.

Could not resolve host: (hostname); Host not found.

I know about 开发者_StackOverflowthe security vulnerabilities with these settings. But right now, I care more about getting this to work. HTTP addresses of course work fine, but those with HTTPS return no content and give an error about not being able to find the hostname. I've searched and didn't find anything useful this time.

function useCurl($xml,$cert,$host){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$host);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSLCERT, $cert);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

$result = curl_exec($ch);

if (curl_error($ch)) {
 print "cURL error: ". curl_error($ch) ."\n<br/>";
}

 curl_close($ch);
 return $result;
}


Have you tried adding curl_setopt($ch, CURLOPT_PORT, 443); so that it connects to the server on the ssl enabled port?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜