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进行解析,得到数组

d a t a = j s o n d e c o d e ( data = json_decode( json, true);

猜你喜欢

转载自blog.csdn.net/qq_41417172/article/details/89186547