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

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 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题