<?php

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

$monthes = array(
    1 => 'Января', 2 => 'Февраля', 3 => 'Марта',
	4 => 'Апреля', 5 => 'Мая', 6 => 'Июня',
	7 => 'Июля', 8 => 'Августа', 9 => 'Сентября',
	10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря'
);

$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];

switch (date("H")) {
case 23:
case 0:
case 1:
case 2:
    $hour = 0;
    break;
case 3:
case 4:
case 5:
    $hour = 1;
    break;
case 6:
case 7:
case 8:
    $hour = 2;
    break;
case 9:
case 10:
case 11:
    $hour = 3;
    break;
case 12:
case 13:
case 14:
    $hour = 4;
    break;
case 15:
case 16:
case 17:
    $hour = 5;
    break;
case 18:
case 18:
case 19:
    $hour = 6;
    break;
case 20:
case 21:
case 22:
    $hour = 7;
    break;
}

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

$out = '';
$out .= date("d ") . $monthes[(date('n'))] . date(" Y") . "\n\n";
$out .= "Картина дня, Москва:\n";
$out .= $wind=$xml->location->day[0]->symbol[desc] . "\n";
$out .= "Температура воздуха:\n";
$out .= 'Min: ' . $wind=$xml->location->day[0]->tempmin[value] . ' ' . $wind=$xml->location->day[0]->tempmin[unit] . ' | ' . 'Max: '.$wind=$xml->location->day[0]->tempmax[value] . ' ' . $wind=$xml->location->day[0]->tempmax[unit] . "\n\n";
$out .= 'Погода на ' . $time . ":";
$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) . " м/с";

echo $out;

//var_dump($xml);

?>