小编the*_*one的帖子

从php调用Web服务?

我试图从PHP网页上调用公开的Web服务.

Web服务是:http://www.webservicex.net/uszip.asmx?WSDL


我的代码:

<html>
<body>
<?php
$zip = $_REQUEST['zip'];
echo 'zip is'.$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 = "http://www.webservicex.net/uszip.asmx?WSDL";
    $client = new soapclient($wsdl, true);
    $response = $client->GetInfoByZIP($zip);
}
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

php web-services

0
推荐指数
1
解决办法
9175
查看次数

标签 统计

php ×1

web-services ×1