$client = new SoapClient("http://example.com/api/v1/ShippingService.wsdl"); $rates = $client->getRates($parameters); foreach ($rates as $rate) { echo $rate->name . ": " . $rate->price . "\n"; }
$client = new SoapClient("https://example.com/Service.svc?singleWsdl"); $parameters = array( 'Origin' => '90210', 'Destination' => '60606', 'Weight' => 10 ); $rates = $client->getRates($parameters);This example creates a new SoapClient instance by passing in the URL of the web service's WSDL file. It then sets up the necessary input parameters for the getRates method and calls it. The resulting rates are assigned to the $rates variable. Package library for SoapClient: The SoapClient is part of the PHP core, which means it is not a separate package that needs to be installed or included.