Php 未使用wp_remote_post()发送XML请求
提前任命。我正在尝试使用wp_remote_post()发送XML请求 我正在尝试向我的短信提供商发送发送一次性OTP的请求Php 未使用wp_remote_post()发送XML请求,php,xml,wordpress,Php,Xml,Wordpress,提前任命。我正在尝试使用wp_remote_post()发送XML请求 我正在尝试向我的短信提供商发送发送一次性OTP的请求 $url = "http://gate.payvand.tj/xml/"; $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <request> <request-type>9</request-type> <terminal-id>".$termid.
$url = "http://gate.payvand.tj/xml/";
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<request>
<request-type>9</request-type>
<terminal-id>".$termid."</terminal-id>
<login>".$login."</login>
<password-md5>".$pwd."</password-md5>
<message txn-id=\"".$txn."\" sign=\"".$sign."\">
<to>
<source-address>".$source_address."</source-address>
<destination-address>".$mobile_number."</destination-address>
<data-encoding>1</data-encoding>
<text>".$message."</text>
</to>
</message>
</request>";
$response = wp_remote_post(
$url,
array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'headers' => array(
'Content-Type' => 'text/xml'
),
'body' => array('postdata' => $xml, 'postfield' => 'value'),
'sslverify' => false
)
);
$url=”http://gate.payvand.tj/xml/";
$xml=”
9
“$termid。”
“$login。”
“$pwd。”
“$source\u地址。”
“$mobile_号码。”
1.
“$message。”
";
$response=wp\u remote\u post(
$url,
排列(
'方法'=>'发布',
“超时”=>45,
“重定向”=>5,
'httpversion'=>'1.0',
'headers'=>数组(
“内容类型”=>“文本/xml”
),
'body'=>array('postdata'=>$xml,'postfield'=>'value'),
'sslverify'=>错误
)
);
我的提供商未收到此请求。
但他是这样接受和执行的
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<request>
<request-type>9</request-type>
<terminal-id>".$termid."</terminal-id>
<login>".$login."</login>
<password-md5>".$pwd."</password-md5>
<message txn-id=\"".$txn."\" sign=\"".$sign."\">
<to>
<source-address>".$source_address."</source-address>
<destination-address>".$mobile_number."</destination-address>
<data-encoding>1</data-encoding>
<text>".$message."</text>
</to>
</message>
</request>";
$ch = curl_init();
$url = "http://gate.payvand.tj/xml/";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$xml=”
9
“$termid。”
“$login。”
“$pwd。”
“$source\u地址。”
“$mobile_号码。”
1.
“$message。”
";
$ch=curl_init();
$url=”http://gate.payvand.tj/xml/";
curl_setopt($ch,CURLOPT_URL,$URL);
curl_setopt($ch,CURLOPT_头,0);
curl_setopt($ch,CURLOPT_HTTPHEADER,数组(“内容类型:text/xml”);
卷曲设置($ch,卷曲设置桩,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,true);
curl_setopt($ch,CURLOPT_禁止重用,true);
curl_setopt($ch,CURLOPT_超时,60);
你能解释一下第一段的错误吗