查詢結果類似如下:
stdClass Object
(
[GetWeatherResult] =>
Shenzhen, China (ZGSZ) 22-33N 114-06E 18M
Jan 19, 2015 - 07:00 AM EST / 2015.01.19 1200 UTC
from the ESE (110 degrees) at 7 MPH (6 KT):0
3 mile(s):0
60 F (16 C)
41 F (5 C)
47%
30.15 in. Hg (1021 hPa)
Success
)
<pre>
<?php
$ws = "http://www.webservicex.net/globalweather.asmx?wsdl";//webservice服務的地址
$client = new SoapClient($ws);
$result=$client->getWeather(array('CityName'=>'shenzhen','CountryName'=>'china'));//查詢中國深圳的天氣,返回的是一個結構體
print_r($result);
測試時需要開啓php_soap擴展