php的SoapClient是专门用来访问web服务的类,这里以访问天气预报的web服务为例,做一个简单的实例。代码如下:

$c = new SoapClient('http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl');

echo "
";

//$array = $c->__getTypes();

$obj = $c->getWeather(array('theCityCode'=>'792'));

$getWeatherResult = $obj->getWeatherResult;

$info = $getWeatherResult->string;

echo "
";

foreach($info as $str)

{

echo $str;

echo "
";

}

把这段代码保存在一个标准的php文件里面,访问一下即可

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2022-02-11
  • 2021-11-15
  • 2021-08-19
  • 2021-06-16
  • 2021-10-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2021-09-27
  • 2021-11-30
  • 2021-12-11
相关资源
相似解决方案