Does not return all xml results

1

I'm having a problem with this xml reader, it just reads the first xml item, can anyone help me? Thanks

<?php
$link = "http://war.deathface.com.br/wo/api_getserverinfo.xml";
$xml = simplexml_load_file($link); 

foreach($xml -> news as $dados){ 
    echo "<strong>Título:</strong> ".utf8_decode($dados -> news['name'])."<br />";
    echo "<br />";
}
    
asked by anonymous 21.07.2016 / 00:20

1 answer

1

try another loop

foreach($xml->news as $v) { 
    foreach($v as $vv){
    echo "<pre>";
        print_r($vv['name']);
    echo "</pre>";
    }
}
    
21.07.2016 / 02:38