Answer the question
In order to leave comments, you need to log in
The Yandex Weather API parser does not return image-v3 (xml, php). Why?
The code that outputs everything is -
<?php
$xml = 'http://export.yandex.ru/weather-ng/forecasts/32150.xml'; //адрес
$rss = simplexml_load_file($xml); //пыдыщ
foreach ($rss->fact as $fact)
{
$temp = $fact->temperature; //выводим температуру
$type = $fact->weather_type; //выводим тип
$pic = $fact->image-v3; //выводим пикчакод
echo $temp;
echo '<br>';
echo $type;
echo '<br>';
echo $pic;
}
?>
Answer the question
In order to leave comments, you need to log in
If you are writing something, then at least turn on error output.
PHP is telling you that there is no such image element, and that the v3 constant is unknown to it. But you don't hear him. And that would clearly tell you which direction to dig. And they would have come with the specific question "how to refer to the image-v3 element?" instead.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question