soapclient调用webservice接口
来源:互联网 发布:麦点商城 知乎 编辑:程序博客网 时间:2024/05/21 17:08
1.开启soap支持,在php.ini中去除extension=php_soap.dll之前的‘;’
2.掉用页面
<?php
header('Content-Type: text/html; charset=UTF-8');
$client = new SoapClient('http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?WSDL');
$parm=array('mobileCode'=>'13782149159','userID'=>'');
$result=$client->getMobileCodeInfo($parm);
$result=get_object_vars($result); //将stdclass object转换为array,这个比较重要了
echo "你的手机卡信息:".$result['getMobileCodeInfoResult'];
?>
function soapclient($para)
{
global $soap_server;
global $db,$tablepre;
try
{
$client = new SoapClient($soap_server);
$client->decode_utf8=false;
$client->xml_encoding='utf-8';
$parameters = array('datacontext' => $para);
$result = $client->Commnuication($parameters);
$response = get_object_vars($result);
$response = $response['CommnuicationResult'];
//$sql = "insert into {$tablepre}soaplogs(soaptype,request,response,dateline,requestip) values('client','".addslashes($para)."','".addslashes($response)."','".time()."','$soap_server')";
//$db->query($sql);
unset($client);
return $result;
}
catch (SoapFault $fault)
{
$array = array("Error"=> $fault->faultcode,"String" => $fault->faultstring);
return $array;
}
}
{
global $soap_server;
global $db,$tablepre;
try
{
$client = new SoapClient($soap_server);
$client->decode_utf8=false;
$client->xml_encoding='utf-8';
$parameters = array('datacontext' => $para);
$result = $client->Commnuication($parameters);
$response = get_object_vars($result);
$response = $response['CommnuicationResult'];
//$sql = "insert into {$tablepre}soaplogs(soaptype,request,response,dateline,requestip) values('client','".addslashes($para)."','".addslashes($response)."','".time()."','$soap_server')";
//$db->query($sql);
unset($client);
return $result;
}
catch (SoapFault $fault)
{
$array = array("Error"=> $fault->faultcode,"String" => $fault->faultstring);
return $array;
}
}
0 0
- soapclient调用webservice接口
- PHP调用webservice soap soapclient
- php调用webservice报错Class 'SoapClient' not found
- 【webservice】调用webservice接口
- 通过SoapClient调用天气预报
- domino 调用 WebService 接口
- WebService 接口调用指南
- php 调用webservice接口!!
- Java WebService 接口调用
- java调用webservice 接口
- webService接口调用
- java调用webservice接口
- android 调用webservice 接口
- cxf调用webservice接口
- wsdl2java 调用webservice接口
- Java调用WebService接口
- java 调用webservice接口
- webservice免费调用接口
- 博客
- 纪念Winxp(盘点那些年我们用过的PC操作系统)
- 考无忧2014职称计算机模拟考试题库软件 逆向分析研究:
- java基础之计算器
- 闰年之循环判断
- soapclient调用webservice接口
- 你做过的最有效的提高你的编程水平的一件事情是什么
- Linux内核构建系统之六
- 认真过好你的二十几岁
- Exercise 36: 设计和调试
- 火狐设置代理
- leetcode:String to Integer (atoi)
- java基础学习-前五天总结
- BTE的理解和开发