Answer the question
In order to leave comments, you need to log in
How to pull element from xml?
I'm trying to extract the date from the xml of the Central Bank of the Russian Federation.
Everything is available at the link itself: TYK
<?
$xml = new DOMDocument();
$date = @$xml->load('http://www.cbr.ru/scripts/XML_daily.asp?date_req=' . date('d/m/Y'));
$root = $date->documentElement;
$valcurs = $root->getElementsByTagName('ValCurs');
echo $valcurs->item(0)->getAttribute('Date');
?>
Fatal error: Uncaught Error: Call to a member function getElementsByTagName() on null in C:\Users\Decay\Desktop\public_html\test\load.php:12 Stack trace: #0 {main} thrown in C:\Users\Decay\Desktop\public_html\test\load.php on line 12
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question