I want to parse this page with php. I wrote this code, but it gives me an error - Invalid argument supplied for foreach()
$opts = array('http' => array('header' => 'Accept-Charset: UTF-8, *;q=0'));
$context = stream_context_create($opts);
$data = file_get_contents('http://cbr.ru/scripts/XML_daily.asp',false, $context);
$xml = simplexml_load_string($data);
foreach($xml->valcurs->valute as $val){
echo "<p>".$val->attributes()->numcode."</p>";
}
var_dump($xml->valcurs->valute)- post the result$xmlcontains the data, right?$xml = simplexml_load_file('http://cbr.ru/scripts/XML_daily.asp');print_r($xml)I have this.