Tolcol
2015-12-18 02:26
采纳率: 50%
浏览 3.4k
已采纳

PHP soap Could not connect to host

function getResult()
{
$url = "http://bcsz.xms.foxhis.com:8080/ItfServerWS/XmsWS?wsdl";//正式地址
// $url = "http://xms.foxhis.com:922/ItfServerWS/XmsWS?wsdl";//测试地址
$postjson = '{"param":{"begin":"2015-12-17","end":"2015-12-18","rmtype":"","ratecode":""},"hotelid":"G000001","pwd":"foxhis","cmmcode":"WEB","user":"foxhis","rq":"rminfo"}';

try {
    $client = new SoapClient($url, array("trace" => true, "connection_timeout" => 100));

// var_dump($client->__getTypes());//列出所有的功能
logE('传入的json', $postjson);
$return = $client->getRoomAmount(array('arg0' => $postjson));//从接口地址获得的数据
logE('接收的值', $return);
$result = $return->return;
logE('返回的json', $result);
return $result;
} catch (SOAPFault $e) {
print_r('Exception:' . $e);
return null;
}

}

用测试接口就能返回数据,但是用正式接口总是Could not connect to host异常,各位大神怎么办?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • Robot-C 2015-12-18 02:37
    已采纳
    导读:   应用程序采用ODBC方式从本机登陆MySQL数据库,出现下面的提示:   [MySQL][ODBC 3.51 Driver]Host HostName is not allowed to connect to this MySQL server   (注:HostName为本机主机名称,在/etc/hosts文件中有设置。)   很明显,应该是权限设置问题,查看一下权限设置......<br/><strong>答案就在这里:</strong><a target='_blank' rel='nofollow' href='http://blog.csdn.net/rayleigh_w/article/details/1968800'>Host 'HostName' is not allowed to connect to this MySQL server </a><br/>----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。
    
    点赞 打赏 评论
  • ezhishui 2015-12-18 02:30

    网络问题吧,dns解析不了主机,你访问域名可以么

    点赞 打赏 评论

相关推荐 更多相似问题