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

PHPz
Release: 2020-09-05 13:57:10
Original
2568 people have browsed it

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”
]);
Copy after login

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

$json = $jsonStatus->getAccountResult;
Copy after login

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

data=jsondecode(data = json_decode(data=jsondecode(json, true);
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!