日期:2014-05-17 浏览次数:20648 次
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/xml;charset=UTF-8 Content-Length: 662 Date: Wed, 28 Mar 2012 02:04:43 GMT Connection: close <!--?xml version="1.0" encoding="UTF-8" standalone="yes"?--> <error_response> <args> <arg><key>sign</key><value>1B6DF27CC81E98EEBE78F5E4765F2E09</value></arg> <arg><key>timestamp</key><value>20120328100423</value></arg> <arg><key>v</key><value>1.0</value></arg> <arg><key>sign_v</key><value>1</value></arg> <arg><key>method</key><value>allinpay.card.cardwithproductinfo.get</value></arg> <arg><key>app_key</key><value>test</value></arg> <arg><key>format</key><value>xml</value></arg> <arg><key>password</key><value>5arHL6zxgecGKGQ nqBVQPRth3zEuJMO</value></arg> <arg><key>card_id</key><value>12345678</value></arg> </args><code>25</code> <msg>无效签名 </msg> </error_response>
$string = <<<XML <error_response> <args> <arg><key>sign</key><value>1B6DF27CC81E98EEBE78F5E4765F2E09</value></arg> <arg><key>timestamp</key><value>20120328100423</value></arg> <arg><key>v</key><value>1.0</value></arg> <arg><key>sign_v</key><value>1</value></arg> <arg><key>method</key><value>allinpay.card.cardwithproductinfo.get</value></arg> <arg><key>app_key</key><value>test</value></arg> <arg><key>format</key><value>xml</value></arg> <arg><key>password</key><value>5arHL6zxgecGKGQ nqBVQPRth3zEuJMO</value></arg> <arg><key>card_id</key><value>12345678</value></arg> </args><code>25</code> <msg>无效签名 </msg> </error_response> XML; echo '<pre>'; $xml = simplexml_load_string($string); var_dump($xml);
------解决方案--------------------
你可以用file_get_contents('aa.xml');然后正则获取。