Home  >  Article  >  Backend Development  >  PHP SOAP调用接口怎么获取数据

PHP SOAP调用接口怎么获取数据

PHPz
PHPzOriginal
2016-06-06 20:17:062582browse

PHP SOAP调用接口获取数据的方法:首先确定需要传递的数据;然后通过语句“$json = $jsonStatus->getAccountResult;”返回json数据;最后对返回的json进行解析即可。

PHP SOAP调用接口怎么获取数据

PHP SOAP调用接口获取数据

这里的地址是对方提供的,以wsdl结尾

$client = new \SoapClient(‘http://1.1.1.1/DomWebservice/DomWebService.asmx?wsdl’,array(‘encoding’=>'utf-8’));

确定需要传递的数据

$jsonStatus = $client->getAccount([
‘code’ => ‘0000000106’,
‘credit’ => “514W”,
‘org’ => “5514”
]);

对方的接口需要返回json数据,后端是可以实现的(不论什么语言)

$json = $jsonStatus->getAccountResult;

PHP 对返回的json进行解析,得到数组

data=jsondecode(data = json_decode(data=jsondecode(json, true);

更多相关技术文章,请访问PHP中文网

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn