I have a XML file with the following contents:
<Klassen>
<Klas>
<Klas>HT1</Klas>
<Omschrijving>Klas HT1</Omschrijving>
</Klas>
<Klas>
<Klas>HT2</Klas>
<Omschrijving>Klas HT2</Omschrijving>
</Klas>
</Klassen>
I want to get the values from the second level Klas
tag. I used the following PHP script, but it doesn't work;
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load($apiurl);
$hallo = $xmlDoc->getElementsByTagName('Klas');
foreach ($hallo as $book) {
$result = $book->nodeValue;
echo '<option value="'.$result.'">'.$result.'</option>';
}
?>
I can't change the tag names because it's not my API and also the creator of the API won't change it. What can I do to get the values (in this example) HT1 and HT2 into the select box?
Thank you!