<?php

function xml_attribute($object, $attribute) {
	if(isset($object[$attribute]))
	return (string) $object[$attribute];
}

$data_file="http://api.pogoda.com/index.php?api_lang=ru&localidad=13564&affiliate_id=qkm6r626snmm&v=2.0"; // адрес xml файла

$city_id=13564; // id города

$xml = simplexml_load_file($data_file); // раскладываем xml на массив

$city=$xml->location[city];

$date = date("H");

if ($date >= 23 and $date < 3) {
$hour = 0;
} elseif ($date >= 3 and $date < 6) {
$hour = 1;
} elseif ($date >= 6 and $date < 9) {
$hour = 2;
} elseif ($date >= 9 and $date < 11) {
$hour = 3;
} elseif ($date >= 11 and $date < 14) {
$hour = 4;
} elseif ($date >= 14 and $date < 17) {
$hour = 5;
} elseif ($date >= 17 and $date < 20) {
$hour = 6;
} elseif ($date >= 20 and $date < 23) {
$hour = 7;
}

$time = xml_attribute($wind=$xml->location->day[1]->hour[$hour], 'value');

$out = '';
$out .= $time . "\n";
$out .= $wind=$xml->location->day[1]->hour[$hour]->value . "\n";
$out .= $wind=$xml->location->day[1]->hour[$hour]->symbol[desc] . "\n";
$out .= 'Температура воздуха: ' . $wind=$xml->location->day[1]->hour[$hour]->temp[value] . ' ' . $wind=$xml->location->day[1]->hour[$hour]->temp[unit] . "\n";
$out .= 'Ощущается как: ' . $wind=$xml->location->day[1]->hour[$hour]->windchill[value] . ' ' . $wind=$xml->location->day[1]->hour[$hour]->windchill[unit] . "\n";
$ms = $wind=$xml->location->day[1]->hour[$hour]->wind[value];
$out .=  'Ветер: ' . round($ms*1000/3600) . " м/с\n";

echo $out;

?>