我有一个由Web服务创建的XML响应文件。当我尝试使用SimpleXML进行解析时,没有任何反应。这是XML响应:
SimpleXMLElement Object
(
[0] => <?xml version="1.0" encoding="utf-8"?><NEWCAR_RESPxmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="www.mydomainge.com/SellerMessages"><X_LEAD_ID>1779237289</XL_ID><SUCCESS>true</SUCCESS><CACHED_RESPONSE>false</CACHED_RESPONSE><PRICE>34.9383</PRICE><DealerList><Dealer><BUYER_ID>0000-2127</BUYER_ID><Reservation_ID>1779237289|0000-2961|8f807d03-4b0d-4329-a728-77398957c757|100025</Reservation_ID><Price>34.9383</Price><Name>Dealer Demo 1</Name><State>MI</State><City>South</City><Street>48985</Street><Postalcode>48075</Postalcode><Distance>0</Distance><DealerGroup id="2961" max_post="0" /><Contact><Phone>2483521313</Phone></Contact><Prequalification>true</Prequalification></Dealer></DealerList></NEWCAR_PINGGX_RESPONSE>
)
这是我的代码:
$context = stream_context_create($stream_options);
$response = file_get_contents($url, null, $context);
file_put_contents("dtx_post_response.xml", $response);
$ResponseXml = simplexml_load_file("dtx_post_response.xml");
$Dealer = $ResponseXml->NEWCAR_RESPONSE->XL_ID;
echo $Dealer;
这个结果是一个空白页面!