Answer the question
In order to leave comments, you need to log in
How to properly get php value from xml?
Tok started learning php. I'm trying to take information from the desired xml item, and store the value in a variable.
But something doesn't come out to do it. How to do this right?
You need to go through the points: info -> traffic-> level and store the value in a variable.
I tried this myself: $level = $childs->{'info'}->{'traffic'}->{'level'}->nodeValue;
address of the xml I want to parse: pastebin.com/vPr7ZCes
Answer the question
In order to leave comments, you need to log in
1) show your code in full
2) write that according to the xml link, it does not open for me
try this:
$xml = file_get_contents('https://export.yandex.ru/bar/reginfo.xml?region=1');
$o = simplexml_load_string( $xml );
var_dump( $o );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question