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

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,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题