第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何獲取php響應(yīng)中的xml

如何獲取php響應(yīng)中的xml

PHP
茅侃侃 2023-07-15 16:50:34
我正在嘗試使用以下代碼從服務(wù)器獲取響應(yīng):<?php$url = "http://pgtest.redserfinsa.com:2027/WebPubTransactor/TransactorWS?WSDL";$post_string = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:web="http://webservices.serfinsa.sysdots.com/">   <soapenv:Header/>   <soapenv:Body>      <web:cardtransaction>         <!--Optional:-->         <security>{"comid":"comid","key":"$!@!@!@!@!@","comwrkstation":"comwrkstation"}</security>         <!--Optional:-->         <txn>MAN</txn>         <!--Optional:-->         <message>{"CLIENT":"9999994570392223"}            </message>      </web:cardtransaction>   </soapenv:Body></soapenv:Envelope>';$post_data = array('xml' => $post_string);$stream_options = array(    'http' => array(        'method'  => 'POST',        'header'  => 'Content-type: text/xml' . "\r\n",        'content' =>  http_build_query($post_data)));$context  = stream_context_create($stream_options);$response = file_get_contents($url, null, $context);?>但是,我仍然收到空回復(fù),有人知道嗎?
查看完整描述

1 回答

?
HUX布斯

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超6個(gè)贊

我不知道為什么你的代碼返回空,但你可以嘗試使用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);

結(jié)果:


接收失?。哼B接被對(duì)等方重置


查看完整回答
反對(duì) 回復(fù) 2023-07-15
  • 1 回答
  • 0 關(guān)注
  • 164 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)