Alle,Aufruf eines Web-Service von PHP?
Atlast hatte unseren Admin das PEAR SOAP-Modul auf unserem Apache-Server installieren. Wenn ich jetzt den folgenden Code ausprobiere - gibt es mir einen Fehler "HTTP Bad Request". Kann jemand helfen?
<html>
<body>
<?php
/* Include PEAR::SOAP's SOAP_Client class: */
require_once('SOAP/Client.php');
$zip = $_REQUEST['zip'];
?>
<form action="wszip.php" method="post">
<table cellspacing="10" bgcolor="CadetBlue">
<tr>
<td><B>Enter Zip Code : </B><input type="text" name="zip" /></td>
<td></td>
<td><input type="Submit" value="Find It!"/></td>
</tr>
</table>
<BR><BR><BR><BR>
</form>
<?php
if($zip != "")
{
$wsdl_url = "http://www.webservicex.net/uszip.asmx?WSDL";
$wsdl = new SOAP_WSDL($wsdl_url);
$client = $wsdl->getProxy();
$params = array('USZip' => $zip);
$response = $client->GetInfoByZIP($params);
echo $response;
}
?>
</body>
</html>
Danke.
Php require_once ('SOAP/Client.php'); $ zip = $ _REQUEST ['zip']; > php if ($ zip! = "") { \t $ wsdl_url = "http://www.webservicex.net/uszip.asmx?WSDL"; \t $ wsdl = neu SOAP_WSDL ($ wsdl_url); \t $ client = $ wsdl-> getProxy(); \t $ params = array ('USZip' => $ zip); \t $ response = $ client-> GetInfoByZIP ($ params); \t Echo $ Antwort; } ?> – thezone