<<&书信电报;php变量中正在使用文本输出xml? $xmlSend=limpiaVariable(urlencode($xmlSend)); $header[]=“内容类型:application/x-www-form-urlencoded”; $ch=curl_init(); $postfields=“info_asj3=1”。$vars; curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch,CURLOPT_URL,$URL); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_超时,250); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$POSTFIELDS); curl_setopt($ch,CURLOPT_HTTPHEADER,$header); $data=curl\u exec($ch); if(旋度误差($ch)){ $data=curl\u错误($ch); }否则{ 卷曲关闭($ch); }
我正在与一家新公司合作,该公司正在使用它连接到xml提要。但是使用这个开头,这就是字符串的语法<<&书信电报;php变量中正在使用文本输出xml? $xmlSend=limpiaVariable(urlencode($xmlSend)); $header[]=“内容类型:application/x-www-form-urlencoded”; $ch=curl_init(); $postfields=“info_asj3=1”。$vars; curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch,CURLOPT_URL,$URL); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_超时,250); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$POSTFIELDS); curl_setopt($ch,CURLOPT_HTTPHEADER,$header); $data=curl\u exec($ch); if(旋度误差($ch)){ $data=curl\u错误($ch); }否则{ 卷曲关闭($ch); },php,xml,curl,Php,Xml,Curl,我正在与一家新公司合作,该公司正在使用它连接到xml提要。但是使用这个开头,这就是字符串的语法 使用Heredoc for string有利于多行字符串,并可以避免引用问题。这是一个Heredoc字符串,如果您遇到问题,可能是由于收尾顺序缩进造成的: 文本//另见 $xmlSend = <<<TEXT <?xml version="1.0" encoding="UTF-8"?>
使用Heredoc for string有利于多行字符串,并可以避免引用问题。这是一个Heredoc字符串,如果您遇到问题,可能是由于收尾顺序缩进造成的: 文本//另见
$xmlSend = <<<TEXT
<?xml version="1.0" encoding="UTF-8"?>
<VMCAMEXM>
<business>
<id_company>{$idCompany}</id_company>
<id_branch>{$idBranch}</id_branch>
<country>{$Country}</country>
<user>{$User}</user>
<pwd>{$pwd}</pwd>
</business>
<transacction>
<merchant>{$Merchant}</merchant>
<reference>50000</reference>
<tp_operation>13</tp_operation>
<creditcard>
<crypto>{$Crypto}</crypto>
<type>V/MC</type>
<name>{$name}</name>
<number>{$number}</number>
<expmonth>{$expmonth}</expmonth>
<expyear>{$expyear}</expyear>
<cvv-csc>{$cvv}</cvv-csc>
</creditcard>
<amount>{$cantidad}</amount>
<currency>{$Currency}</currency>
<usrtransacction>1</usrtransacction>
</transacction>
</VMCAMEXM>
TEXT;
echo "<pre>";
print_r(htmlspecialchars($xmlSend));
echo "</pre>";
//$url = $tUrl;
$vars = "&xml=" . $rc4->limpiaVariable(urlencode($xmlSend));
$header[] = "Content-type: application/x-www-form-urlencoded";
$ch = curl_init();
$postfields = "info_asj3=1".$vars;
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL,$Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 250);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$data = curl_exec($ch);
if (curl_errno($ch)) {
$data = curl_error($ch);
} else {
curl_close($ch);
}