I need to use an external XML file, I’ve tried different methods to read the file but can’t reach what I want.
I used DOMDocument simplexml_load_file
<?
$xml = simplexml_load_file("http://www.isecur1ty.org/InternetThreat/ThreatLevel.xml");
echo $xml->getName() . "<br />";
foreach($xml->children() as $child)
{
echo $child->getName() . ": " . $child . "<br />";
}
?>
But can’t get it working with me!!
Here is the XML file:
<iS-InternetThreat>
<level>
<current>2</current>
<previous>2</previous>
<status>same</status>
<date>09-06-2012</date>
</level>
<version>2.5</version>
</iS-InternetThreat>
As you can see, there are multi-levels. I need to get the values of each attribute (mainly under “level”), getting the version would be also ok.
Can somebody tell me how to do this?
Thanks.
OK, Got it 😀
here is the solution, hope anyone can find it useful.