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異常,各位大神怎麼辦?
導讀: 應用程序采用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,以上是依據我對問題的理解給出的答案,如果解決了你的問題,望采納。