Цикл каждого навыка, а не только немногие из них

Я пытаюсь перебрать все умения, которые можно найти в EVE Online ( API Skilltree), но следующий код только перебирает первые 7 групп умений.

$skilltree_url = file_get_contents('https://api.eveonline.com/eve/SkillTree.xml.aspx', 0, null, null);
$skilltree = simplexml_load_string($skilltree_url);

foreach($skilltree->result->rowset->row AS $skill) {
    var_dump($skill->rowset->row->attributes()->typeID);
}

Что я сделал не так?

Заранее спасибо.

РЕДАКТИРОВАТЬ

Этот код:

$xml = simplexml_load_file('https://api.eveonline.com/eve/SkillTree.xml.aspx');
$skilltree = $xml->result->rowset;
foreach($skilltree->row as $skill) {
    var_dump($skill->rowset->row->attributes()->typeID);
}

Печатает это:

object(SimpleXMLElement)[7]
  string '2403' (length=4)
object(SimpleXMLElement)[6]
  string '3184' (length=4)
object(SimpleXMLElement)[7]
  string '3300' (length=4)
object(SimpleXMLElement)[6]
  string '3319' (length=4)
object(SimpleXMLElement)[7]
  string '3327' (length=4)
object(SimpleXMLElement)[6]
  string '3348' (length=4)
object(SimpleXMLElement)[7]
  string '3355' (length=4)
object(SimpleXMLElement)[6]
  string '3363' (length=4)
object(SimpleXMLElement)[7]
  string '3380' (length=4)
object(SimpleXMLElement)[6]
  string '3392' (length=4)
object(SimpleXMLElement)[7]
  string '3402' (length=4)
object(SimpleXMLElement)[6]
  string '3413' (length=4)
object(SimpleXMLElement)[7]
  string '3426' (length=4)
object(SimpleXMLElement)[6]
  string '3436' (length=4)
object(SimpleXMLElement)[7]
  string '3443' (length=4)
object(SimpleXMLElement)[6]
  string '3449' (length=4)
object(SimpleXMLElement)[7]
  string '3551' (length=4)
object(SimpleXMLElement)[6]
  string '3731' (length=4)
object(SimpleXMLElement)[7]
  string '3755' (length=4)
object(SimpleXMLElement)[6]
  string '3893' (length=4)
object(SimpleXMLElement)[7]
  string '4385' (length=4)
object(SimpleXMLElement)[6]
  string '4411' (length=4)
object(SimpleXMLElement)[7]
  string '9955' (length=4)
object(SimpleXMLElement)[6]
  string '11015' (length=5)
object(SimpleXMLElement)[7]
  string '11075' (length=5)
object(SimpleXMLElement)[6]
  string '11082' (length=5)
object(SimpleXMLElement)[7]
  string '11204' (length=5)
object(SimpleXMLElement)[6]
  string '11207' (length=5)
object(SimpleXMLElement)[7]
  string '11208' (length=5)
object(SimpleXMLElement)[6]
  string '11395' (length=5)
object(SimpleXMLElement)[7]
  string '11433' (length=5)
object(SimpleXMLElement)[6]
  string '11566' (length=5)
object(SimpleXMLElement)[7]
  string '11569' (length=5)
object(SimpleXMLElement)[6]
  string '11579' (length=5)
object(SimpleXMLElement)[7]
  string '11584' (length=5)
object(SimpleXMLElement)[6]
  string '11858' (length=5)
object(SimpleXMLElement)[7]
  string '12092' (length=5)
object(SimpleXMLElement)[6]
  string '12179' (length=5)
object(SimpleXMLElement)[7]
  string '12180' (length=5)
object(SimpleXMLElement)[6]
  string '12201' (length=5)
object(SimpleXMLElement)[7]
  string '12241' (length=5)
object(SimpleXMLElement)[6]
  string '12305' (length=5)
object(SimpleXMLElement)[7]
  string '12365' (length=5)
object(SimpleXMLElement)[6]
  string '12368' (length=5)
object(SimpleXMLElement)[7]
  string '12441' (length=5)
object(SimpleXMLElement)[6]
  string '12484' (length=5)
object(SimpleXMLElement)[7]
  string '12834' (length=5)
object(SimpleXMLElement)[6]
  string '13278' (length=5)
object(SimpleXMLElement)[7]
  string '13279' (length=5)
object(SimpleXMLElement)[6]
  string '16069' (length=5)
object(SimpleXMLElement)[7]
  string '16281' (length=5)
object(SimpleXMLElement)[6]
  string '16591' (length=5)
object(SimpleXMLElement)[7]
  string '16594' (length=5)
object(SimpleXMLElement)[6]
  string '17940' (length=5)
object(SimpleXMLElement)[7]
  string '18025' (length=5)
object(SimpleXMLElement)[6]
  string '18580' (length=5)
object(SimpleXMLElement)[7]
  string '19430' (length=5)
object(SimpleXMLElement)[6]
  string '19759' (length=5)
object(SimpleXMLElement)[7]
  string '20127' (length=5)
object(SimpleXMLElement)[6]
  string '20209' (length=5)
object(SimpleXMLElement)[7]
  string '20327' (length=5)
object(SimpleXMLElement)[6]
  string '20342' (length=5)
object(SimpleXMLElement)[7]
  string '20433' (length=5)
object(SimpleXMLElement)[6]
  string '20494' (length=5)
object(SimpleXMLElement)[7]
  string '20524' (length=5)
object(SimpleXMLElement)[6]
  string '21059' (length=5)
object(SimpleXMLElement)[7]
  string '21071' (length=5)
object(SimpleXMLElement)[6]
  string '21603' (length=5)
object(SimpleXMLElement)[7]
  string '21610' (length=5)
object(SimpleXMLElement)[6]
  string '21666' (length=5)
object(SimpleXMLElement)[7]
  string '21668' (length=5)
object(SimpleXMLElement)[6]
  string '21718' (length=5)
object(SimpleXMLElement)[7]
  string '21802' (length=5)
object(SimpleXMLElement)[6]
  string '21803' (length=5)
object(SimpleXMLElement)[7]
  string '22043' (length=5)
object(SimpleXMLElement)[6]
  string '22172' (length=5)
object(SimpleXMLElement)[7]
  string '22242' (length=5)
object(SimpleXMLElement)[6]
  string '22536' (length=5)
object(SimpleXMLElement)[7]
  string '22541' (length=5)
object(SimpleXMLElement)[6]
  string '22551' (length=5)
object(SimpleXMLElement)[7]
  string '22552' (length=5)
object(SimpleXMLElement)[6]
  string '22578' (length=5)
object(SimpleXMLElement)[7]
  string '22761' (length=5)
object(SimpleXMLElement)[6]
  string '22806' (length=5)
object(SimpleXMLElement)[7]
  string '23069' (length=5)
object(SimpleXMLElement)[6]
  string '23087' (length=5)
object(SimpleXMLElement)[7]
  string '23566' (length=5)
object(SimpleXMLElement)[6]
  string '23950' (length=5)
object(SimpleXMLElement)[7]
  string '24241' (length=5)
object(SimpleXMLElement)[6]
  string '24242' (length=5)
object(SimpleXMLElement)[7]
  string '24268' (length=5)
object(SimpleXMLElement)[6]
  string '24270' (length=5)
object(SimpleXMLElement)[7]
  string '24311' (length=5)
object(SimpleXMLElement)[6]
  string '24562' (length=5)
object(SimpleXMLElement)[7]
  string '24568' (length=5)
object(SimpleXMLElement)[6]
  string '24571' (length=5)
object(SimpleXMLElement)[7]
  string '24606' (length=5)
object(SimpleXMLElement)[6]
  string '24613' (length=5)
object(SimpleXMLElement)[7]
  string '24624' (length=5)
object(SimpleXMLElement)[6]
  string '24625' (length=5)
object(SimpleXMLElement)[7]
  string '24764' (length=5)
object(SimpleXMLElement)[6]
  string '25233' (length=5)
object(SimpleXMLElement)[7]
  string '25530' (length=5)
object(SimpleXMLElement)[6]
  string '25544' (length=5)
object(SimpleXMLElement)[7]
  string '25718' (length=5)
object(SimpleXMLElement)[6]
  string '25739' (length=5)
object(SimpleXMLElement)[7]
  string '25863' (length=5)
object(SimpleXMLElement)[6]
  string '26224' (length=5)
object(SimpleXMLElement)[7]
  string '26252' (length=5)
object(SimpleXMLElement)[6]
  string '27911' (length=5)
object(SimpleXMLElement)[7]
  string '27936' (length=5)
object(SimpleXMLElement)[6]
  string '28073' (length=5)
object(SimpleXMLElement)[7]
  string '28164' (length=5)
object(SimpleXMLElement)[6]
  string '28261' (length=5)
object(SimpleXMLElement)[7]
  string '28373' (length=5)
object(SimpleXMLElement)[6]
  string '28374' (length=5)
object(SimpleXMLElement)[7]
  string '28585' (length=5)
object(SimpleXMLElement)[6]
  string '28604' (length=5)
object(SimpleXMLElement)[7]
  string '28609' (length=5)
object(SimpleXMLElement)[6]
  string '28631' (length=5)
object(SimpleXMLElement)[7]
  string '28656' (length=5)
object(SimpleXMLElement)[6]
  string '28879' (length=5)
object(SimpleXMLElement)[7]
  string '29029' (length=5)
object(SimpleXMLElement)[6]
  string '30324' (length=5)
object(SimpleXMLElement)[7]
  string '30532' (length=5)
object(SimpleXMLElement)[6]
  string '30650' (length=5)
object(SimpleXMLElement)[7]
  string '30788' (length=5)
object(SimpleXMLElement)[6]
  string '32339' (length=5)
object(SimpleXMLElement)[7]
  string '32435' (length=5)
object(SimpleXMLElement)[6]
  string '32797' (length=5)
object(SimpleXMLElement)[7]
  string '32856' (length=5)
object(SimpleXMLElement)[6]
  string '32918' (length=5)
object(SimpleXMLElement)[7]
  string '32999' (length=5)

1 ответ

Решение

Это должно работать, и немного проще в использовании:

$xml = simplexml_load_file('https://api.eveonline.com/eve/SkillTree.xml.aspx');
$skilltree = $xml->result->rowset;
foreach($skilltree->row as $skill) {
    var_dump($skill->rowset->row->attributes()->typeID);
}

Редактировать:

Это должно быть все, что вам нужно, остальные атрибуты, которые вы сможете выяснить самостоятельно:

$xml = simplexml_load_file('https://api.eveonline.com/eve/SkillTree.xml.aspx');
$skilltree = $xml->result->rowset;
foreach($skilltree->row as $skillgroup) {
    echo 'Group name: ' .$skillgroup->attributes()->groupName .'<br />';
    foreach ($skillgroup->rowset->row as $skill) {
        echo 'Type ID: ' .$skill->attributes()->typeID .'<br />';
        echo 'Type name: ' .$skill->attributes()->typeName .'<br />';
    }
    echo '<br />';
}
Другие вопросы по тегам