curl post xml报文
- 发起请求
public static function http_xml_buildData($url,$param){
$xml = self::arrayToXml($param);
$header = ['Content-type: text/xml'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
public static function arrayToXml($data=[],$isEscape=true){
$xml='<xml>';
foreach ($data as $k=