ho un file xml da cui prelevare dei dati:
il quale viene convertito in stringa e su questa aplicata la funzionecodice:<?xml version="1.0" encoding="ISO-8859-1" ?> - <rss version="2.0"> - <channel> <title>Weather Underground - Bergamo, Italy</title> <link>http://www.wunderground.com/</link> <description>Weather Underground RSS Feed</description> <language>EN</language> - <image> <url>http://icons.wunderground.com/graphi...ransparent.gif</url> <link>http://www.wunderground.com</link> <title>Weather Underground</title> </image> <category>weather</category> - <item> <title>Bergamo, Italy Current Conditions - 11:50 AM CET Dec. 27</title> <link>http://www.wunderground.com/global/stations/16076.html</link> <description>Temperature: 34°F / 1°C | Humidity: 87% | Pressure: 29.59in / 1002hPa | Conditions: Light Snow | Wind Direction: Variable | Wind Speed: 2mph / 4km/h | Updated: 11:50 AM CET</description> <pubDate>Tue, 27 Dec 2005 10:50:00 GMT</pubDate> </item> </channel> </rss>
ergi("<description>(.+)</description>", $file_string, $rges);
facendo
print_r($rges)
ottendo un arrai con due stringhe:
Array
(
[0] => <description>Weather Underground RSS Feed</description>
<language>EN</language>
<image>
<url>http://icons.wunderground.com/graphi...ransparent.gif</url>
<link>http://www.wunderground.com</link>
<title>Weather Underground</title>
</image>
<category>weather</category>
<item>
<title>Bergamo, Italy Current Conditions - 11:50 AM CET Dec. 27</title>
<link>http://www.wunderground.com/global/stations/16076.html</link>
<description>Temperature: 34°F / 1°C | Humidity: 87% | Pressure: 29.59in / 1002hPa | Conditions: Light Snow | Wind Direction: Variable | Wind Speed: 2mph / 4km/h | Updated: 11:50 AM CET
</description>
[1] => Weather Underground RSS Feed</description>
<language>EN</language>
<image>
<url>http://icons.wunderground.com/graphi...ransparent.gif</url>
<link>http://www.wunderground.com</link>
<title>Weather Underground</title>
</image>
<category>weather</category>
<item>
<title>Bergamo, Italy Current Conditions - 11:50 AM CET Dec. 27</title>
<link>http://www.wunderground.com/global/stations/16076.html</link>
<description>Temperature: 34°F / 1°C | Humidity: 87% | Pressure: 29.59in / 1002hPa | Conditions: Light Snow | Wind Direction: Variable | Wind Speed: 2mph / 4km/h | Updated: 11:50 AM CET
)
come mai?