无法解析主机 [英] Could not resolve host

查看:158
本文介绍了无法解析主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个随机开始在我的开发计算机上再次发生。它在生产服务器上正常工作,所以无论如何。但我仍然需要在这里测试。

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.


无法解析host:(hostname);找不到主机。

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

我知道这些设置的安全漏洞。但是现在,我更关心让这个工作。 HTTP地址当然工作正常,但那些与HTTPS不返回任何内容,并给出一个错误,无法找到主机名。我已经搜索过,没有找到任何有用的这一次。

I know about the 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;
}


推荐答案

c $ c> curl_setopt($ ch,CURLOPT_PORT,443); ,以便它连接到启用ssl的端口上的服务器?

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

这篇关于无法解析主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆