php获取通过http协议post提交过来xml数据及解析xml
php 如何获取请求的xml数据,对方通过http协议post提交过来xml数据,php如何获取到这些数据呢?
<?php
$xml_data ='<aatavailreq1>'.
'<agency>'.
'<iata>1234567890</iata>'.
'<agent>lgsoftwares</agent>'.
'<password>mypassword</password>'.
'<brand>phpmind.com</brand>'.
'</agency>'.
'<passengers>'.
'<adult age="" id="1"></adult>'.
'<adult age="" id="2"></adult>'.
'</passengers>'.
'<hotelavailreq1>'.
'<destcode>jhm</destcode>'.
'<hotelcode>oggshe</hotelcode>'.
'<checkindate>101009</checkindate>'.
'<checkoutdate>101509</checkoutdate>'.
'<usefield>1</usefield>'.
'</hotelavailreq1>'.
'</aatavailreq1>';
$url = "https://www.yourwebserver.com/path/";
$ch = curl_init($url);
curl_setopt($ch, curlopt_mute, 1);
curl_setopt($ch, curlopt_ssl_verifyhost, 0);
curl_setopt($ch, curlopt_ssl_verifypeer, 0);
curl_setopt($ch, curlopt_post, 1);
curl_setopt($ch, curlopt_httpheader, array('content-type: text/xml'));
curl_setopt($ch, curlopt_postfields, "$xml_data");
curl_setopt($ch, curlopt_returntransfer, 1);
$output = curl_exec($ch);
curl_close($ch);
?>
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
HTTP状态码大全
转自:https://www.cnblogs.com/lxinxuan/archive/2009/10/22/1...
[阅读全文]
-
-
-
-
-
-
-
网友评论