Original: Php--soapclient Visit webservice
Calling weather forecasts via SoapClient
<?php
Header("content-type:text/html; charset=gb2312 ");
/*
* Specify the WebService path and initialize a WebService client
*/
$ws= "HTTP://WWW.WEBSERVICEX.NET/GLOBALWEATHER.ASMX?WSDL";address of the//webservice service
$client=NewSoapClient ($ws);
/*
* Get all the methods provided by the service that the SoapClient object references
*/
Echo("Open functions provided by the SOAP server:");
Echo(' <pre> ');
Var_dump($client->__getfunctions ());//Get methods available on the server
Echo(' </pre> ');
Echo("type provided by the SOAP server:");
Echo(' <pre> ');
Var_dump($client->__gettypes ());//Get data types on the server
Echo(' </pre> ');
Echo("The result of executing getguidnode:");
$result=$client->getweather (Array(' cityname ' = ' zhengzhou ', ' countryname ' = ' China ');//inquire about the weather in Zhengzhou, China, and return a structure
Echo $result->getweatherresult;//Display results
?>
Php--soapclient Access WebService