simplexml - Reading Xml Nodes with PHP -
this question has answer here:
- how parse , process html/xml in php? 27 answers
i have problem php. cannot read xml php, , simplexml. how can do.
my xml files below. want companylist.
<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <soap:header> <wsa:action>http://www.temp/response</wsa:action> <wsa:messageid>urn:uuid:eac190a5-c833-4dee-b4ef-fa81b0bad5c1</wsa:messageid> <wsa:relatesto>urn:uuid:834ace07-1e96-49d9-b958-3b2b87169917</wsa:relatesto> <wsa:to>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:to> <wsse:security> <wsu:timestamp wsu:id="timestamp-55f3bafa-087a-4971-975d-a314957b4282"> <wsu:created>2016-11-17t15:12:46z</wsu:created> <wsu:expires>2016-11-17t15:17:46z</wsu:expires> </wsu:timestamp> </wsse:security> </soap:header> <soap:body> <listresponse xmlns="http://fatura.edoksis.net"> <companyresult> <success>1</sonuc> <companylist> <company> <identifier>8380436088</identifier> <registertime>2016-10-21t00:00:00z</registertime> </company> <company> <identifier>8380436088</identifier> <registertime>2016-10-21t00:00:00z</registertime> </company> </companylist> </companyresult> </companyresult> </soap:body> </soap:envelope>
$dom = new domdocument; $dom->loadxml($response); $books = $dom->getelementsbytagname('identifier'); foreach ($books $book) { echo $book->nodevalue ."</br>"; }
Comments
Post a Comment