這篇文章主要為大家詳細介紹了php 獲取post的xml數據并解析示例,具有一定的參考價值,可以用來參考一下。
對php獲取post過來的xml數據并解析感興趣的小伙伴,下面一起跟隨512筆記的小編兩巴掌來看看吧!
如何獲取請求的xml數據,對方通過http協議post提交過來xml數據,php如何獲取到這些數據呢?
/**
* php獲取post過來的xml數據并解析
*
* @param
* @arrange 五一二筆記網: 512Pic.com
**/
$xml_data =''.
''.
'1234567890'.
'lgsoftwares'.
'mypassword'.
'phpmind.com'.
''.
''.
''.
''.
''.
''.
'JHM'.
'OGGSHE'.
'101009'.
'101509'.
'1'.
''.
'';
$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);
/*** 來自512筆記(www.512pic.com) ***/
注:關于php 獲取post的xml數據并解析示例的內容就先介紹到這里,更多相關文章的可以留意512筆記的其他信息。
關鍵詞:xml