开启 extension = php_soap.dll extension = php_curl.dll extension = php_openssl.dll
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script> <form action="b.php" method="post"> id:<input type="text" name="id" id="id"><br><br> 开始时间:<input type="date" name="starttime"><br><br> 结束时间:<input type="date" name="endtime"><br> <input type="submit"><br><br> </form> <?php header("content-type:text/html;charset=utf-8"); $client = new SoapClient("http://XXX.XXX.XXX.XXX:XXX/Service.asmx?WSDL"); //本行测试不可行 $client = new SoapClient(" http://192.168.3.178:8080/chkwelepsw.asmx?WSDL/ChkWele?username=test3&psw=123"); //参数这样传递 先包装一下 $param = array();//a页面传参过来 //调用必须用__soapCall $p = $client->__soapCall('GetAllDeerpens',array('parameters' => $param)); $data = $p->GetAllDeerpensResult->Basdeerpen; //这里先输出一下变量$p,看看是什么类型。 /* echo "<pre>"; print_r ($data); echo "</pre>"; */ echo "<ol>"; foreach ($data as $key=>$value){ /* echo "<pre>"; print_r ($value); echo "</pre>"; */ /* echo $value->Penname; echo $value->Basdeerpenid; echo "<br>"; */ echo "<li><a onclick="getid('".$value->Basdeerpenid."');" >".$value->Penname."</a></li>"; } echo "</ol>"; ?> <script> function getid(id){ $("#id").val(id); } </script>