码迷,mamicode.com
首页 > Web开发 > 详细

php 读取webservice接口

时间:2016-07-04 17:05:59      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

开启

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>

 

php 读取webservice接口

标签:

原文地址:http://www.cnblogs.com/hellowzd/p/5640962.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!