开启扩展
同时要开启ini.php 的
extension=php_openssl.dll
客户端的例子:
<?php
header("Content-type: text/html; charset=utf-8");
$date=array('byProvinceName'=>'北京');
try {
$client = new SoapClient('http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl');
$result = array();
$result = $client->getSupportCity($date);
print_r($result);
}catch(SoapFault $client){
echo $client->getMessage();
}catch(Exception $client){
echo $client->getMessage();
}
执行后
stdClass Object | |
( | |
[getSupportCityResult] => stdClass Object | |
( | |
[string] => Array | |
( | |
[0] => 北京 (54511) | |
[1] => 上海 (58367) | |
[2] => 天津 (54517) | |
[3] => 重庆 (57516) | |
) | |
) | |
) |