K
K
Kusmich2015-11-12 17:07:35
PHP
Kusmich, 2015-11-12 17:07:35

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

2 answer(s)
V
Vitaly Orlov, 2015-11-12
@Kusmich

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 );

N
newobj, 2015-11-12
@newobj

Show code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question