Yellow highlighted portion is SOAP Web Service URI
Green Highlighted portion is the method name.
And red one is argument name for the method.
<?php $client = new SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL", array('trace' => 1)); $result = $client -> GetGeoIP(array('IPAddress' => '63.23.32.12')); echo "<p> <strong>Country Name</strong> " . $result->GetGeoIPResult->CountryName . "</p>"; echo "<h2>For debugging purposes</h2> \n <h3>Request HTTP Headers:</h3> \n <pre>" . htmlentities($client->__getLastRequestHeaders(), ENT_QUOTES ) . "</pre>\n"; echo "<h3>Request as XML string:</h3>\n" . htmlentities($client->__getLastRequest(), ENT_QUOTES ) . "<br>\n"; echo "<hr><h3>SOAP Response as XML string:</h3>" . htmlentities($client->__getLastResponse(), ENT_QUOTES ) . "<br>\n "; echo "<h3>Response HTTP Headers:</h3>\n<pre>" . htmlentities($client->__getLastResponseHeaders(), ENT_QUOTES ) . "</pre>\n"; echo"<hr><h3>SOAP Response as object</h3><pre>"; print_r($result); echo"</pre>"; ?>
The SoapClient class creates, sends and receive all the necessary HTTP headers and SOAP envelopes.
No comments:
Post a Comment