I cannot parse XML ( http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote ) The document is taken normally, a Simple XML object is created, but I cannot select any element, I do this:

include 'func.lib.php'; include 'simple_html_dom.php'; //Π·Π°Π³Ρ€ΡƒΠΆΠ°Π΅ΠΌ страничку ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ cURL $a = getLink('http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote'); $xml = simplexml_load_string($a); echo $xml->resourse[0]->field[2]; 

does not print anything, tell me what I'm doing wrong.

  • But. Three questions "How to parse XML" per day - this is already a bust - Ipatyev

1 answer 1

Maybe the problem is that there is no "resourse"?

 $xml->resources->resource[0]->field[2] 
  • Thank! And I also want to take away the value of the field, I write like this print_r ($ xml-> resources-> resource [148] -> field ['price']); the empty field comes - rodgers
  • You see what's in the field array, what keys and what values - Bookin