#curl 模拟POST提交xml数据 file_get_contents("php://input")
$xml_data ='<xml>
<appid><![CDATA[12fdsaf3gvdfs]]></appid>
<attach><![CDATA[支付测试]]></attach>
<bank_type><![CDATA[eeee]]></bank_type>
<fee_type><![CDATA[CNY]]></fee_type>
<is_subscribe><![CDATA[Y]]></is_subscribe>
<mch_id><![CDATA[443323]]></mch_id>
<nonce_str><![CDATA[4dddsfadsa5dsagfda]]></nonce_str>
<openid><![CDATA[afddsadfafsdfa453asf]]></openid>
<out_trade_no><![CDATA[14093811653]]></out_trade_no>
<result_code><![CDATA[SUCCESS]]></result_code>
<return_code><![CDATA[SUCCESS]]></return_code>
<sign><![CDATA[4fcdFDDDDFSAFasDEASFA]]></sign>
<sub_mch_id><![CDATA[33321121]]></sub_mch_id>
<time_end><![CDATA[20340390331341540]]></time_end>
<total_fee>1</total_fee>
<trade_type><![CDATA[JSAPI]]></trade_type>
<transaction_id><![CDATA[fdaFDSAfafDSAFdadfDDddDDD]]></transaction_id>
</xml>';
$URL = "http://www.test.com/test/test2.php";
$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);
print_r($output);
#http://www.test.com/test/test2.php 文件处理
$xml = file_get_contents("php://input");
$data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
print_r($data);