Код: Выделить всё
<?xml version="1.0" encoding="utf-8"?>
<weather created="rp5.ru" date="2012-2-29">
<point id="2622">
<point_id>2622</point_id>
<region_id>27</region_id>
<country_id>3</country_id>
<point_name>Горно-Алтайск</point_name>
<point_name_trim>Горно-Алтайск</point_name_trim>
<point_name2>в Горно-Алтайске</point_name2>
<point_timestamp>1330520361</point_timestamp>
<gmt_add>7</gmt_add>
<point_date>Wed, 29 Feb 2012 12:59:21 +0700</point_date>
<point_date_time>2012-2-29 12:59 </point_date_time>
<timestep>
<time_step>12</time_step>
<datetime>2012-2-29 19:00</datetime>
<G>19</G>
<HHii>19:00</HHii>
<cloud_cover>0</cloud_cover>
<precipitation>0.0</precipitation>
<pressure>741</pressure>
<temperature>-10</temperature>
<humidity>74</humidity>
<wind_direction>З</wind_direction>
<wind_velocity>1</wind_velocity>
<falls>0</falls>
<drops>0</drops>
</timestep>
<timestep>
<time_step>24</time_step>
<datetime>2012-3-01 07:00</datetime>
<G>7</G>
<HHii>07:00</HHii>
<cloud_cover>0</cloud_cover>
<precipitation>0.0</precipitation>
<pressure>743</pressure>
<temperature>-19</temperature>
<humidity>83</humidity>
<wind_direction>В</wind_direction>
<wind_velocity>2</wind_velocity>
<falls>0</falls>
<drops>0</drops>
</timestep>
<timestep>
<time_step>36</time_step>
<datetime>2012-3-01 19:00</datetime>
<G>19</G>
<HHii>19:00</HHii>
<cloud_cover>0</cloud_cover>
<precipitation>0.0</precipitation>
<pressure>744</pressure>
<temperature>-10</temperature>
<humidity>75</humidity>
<wind_direction>З</wind_direction>
<wind_velocity>1</wind_velocity>
<falls>0</falls>
<drops>0</drops>
</timestep>
<timestep>
<time_step>48</time_step>
<datetime>2012-3-02 07:00</datetime>
<G>7</G>
<HHii>07:00</HHii>
<cloud_cover>0</cloud_cover>
<precipitation>0.0</precipitation>
<pressure>746</pressure>
<temperature>-18</temperature>
<humidity>86</humidity>
<wind_direction>В</wind_direction>
<wind_velocity>1</wind_velocity>
<falls>0</falls>
<drops>0</drops>
</timestep>
</point>
</weather>
Код: Выделить всё
<?php
$pogoda = file_get_contents('http://rp5.ru/xml/2622/00000/ru');
preg_match('/<point_name_trim>(.*?)<\/point_name_trim>/i',$pogoda, $name);
preg_match('/<cloud_cover>(.*?)<\/cloud_cover>/i',$pogoda,$type);
preg_match('/<humidity>(.*?)<\/humidity>/i',$pogoda,$vlaga);
preg_match('/<temperature>(.*?)<\/temperature>/i',$pogoda,$temp);
preg_match('/<falls>(.*?)<\/falls>/i',$pogoda,$osadki);
preg_match('/<pressure>(.*?)<\/pressure>/i',$pogoda,$press);
preg_match('/<wind_direction>(.*?)<\/wind_direction>/i',$pogoda,$napravlenie_vetra);
preg_match('/<wind_velocity>(.*?)<\/wind_velocity>/i',$pogoda,$skorost_vetra);
preg_match('/<drops>(.*?)<\/drops>/',$pogoda, $kol_osadkov);
$vivod = "
Облачность $type[1] %
Осадки $osadki[1] - $kol_osadkov[1]
Температура $temp[1] °C
Влажность: $vlaga[1] %
Давление: $press[1] мм рт. ст.
Направление ветра: $napravlenie_vetra[1]
Скорость ветра, м/с: $skorost_vetra[1]
";
echo $vivod;
?>
если я правильно понял, то надо использовать preg_match_all... а вот с ним нихрена не выходит (((
подскажите как это реализовать?