title: Calling a web service from php?
body: <p>I am trying to call a publicly available web service from a PHP web page.</p>
  <p>The web service is: <a href="http://www.webservicex.net/uszip.asmx?WSDL" rel="nofollow noreferrer">http://www.webservicex.net/uszip.asmx?WSDL</a></p>
  <hr />
  <h3>My code:</h3>
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;?php
  $zip = $_REQUEST['zip'];
  echo 'zip is'.$zip;
  ?&gt;
  &lt;form action=&quot;wszip.php&quot; method=&quot;post&quot;&gt;
  &lt;table cellspacing=&quot;10&quot; bgcolor=&quot;CadetBlue&quot;&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;B&gt;Enter Zip Code : &lt;/B&gt;&lt;input type=&quot;text&quot; name=&quot;zip&quot; /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;Submit&quot; value=&quot;Find It!&quot;/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
  &lt;/form&gt;
  &lt;?php
  if($zip != &quot;&quot;)
  {
      $wsdl = &quot;http://www.webservicex.net/uszip.asmx?WSDL&quot;;
      $client = new soapclient($wsdl, true);
      $response = $client-&gt;GetInfoByZIP($zip);
  }
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>