1 回答
TA贡献1876条经验 获得超6个赞
我不知道为什么你的代码返回空,但你可以尝试使用curl
代码:
$url = "http://pgtest.redserfinsa.com:2027/WebPubTransactor/TransactorWS?WSDL";
$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservices.serfinsa.sysdots.com/">
<soapenv:Header/>
<soapenv:Body>
<web:cardtransaction>
<security>{"comid":"comid","key":"$!@!@!@!@!@","comwrkstation":"comwrkstation"}</security>
<txn>MAN</txn>
<message>{"CLIENT":"9999994570392223"}
</message>
</web:cardtransaction>
</soapenv:Body>
</soapenv:Envelope>';
$headers = array(
"Content-type: text/xml",
"Content-length: " . strlen($xml),
"Connection: close",
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
$error = curl_error($curl);
print_r($response);
print_r($error);
结果:
接收失败:连接被对等方重置
- 1 回答
- 0 关注
- 121 浏览
添加回答
举报