I'm using Codeigniter 3 and I tried to take value of xml. I didn't handle..
I tried to take value with this code.
$dom = new DOMDocument();
$dom->loadlXML($xml);
$img = $dom->getElementsByTagName('sonucKodu')->item(0);
echo $img->attributes->getNamedItem("value")->value;
My xml file.
<?xml version="1.0" encoding="UTF-8"?>
<SYSMessage xmlns:ext="http://nxxx/Cd/Extensions/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<messageType code="1" value="xxx" codeSystemGuid="0a9ba485-e7e0-4abb-9c86-0a14fd364bb8" version="1" />
<documentGenerationTime value="201512041717" />
<author>
<healthcareProvider code="0" value="SYS" codeSystemGuid="c9dbe1cb-57cb-48fb-bdd3-d622e0e304c6" version="1" />
</author>
<recordData>
<KayitCevabi>
<sonucKodu value="E2003" />
<sonucMesaji value="TakipNo geçerli değil" />
</KayitCevabi>
</recordData>
</SYSMessage>
I just need value of attribute sonucKodu
. It must be E2003
.
Thanks for your helping.