este es el codigo de mi PHP
Código :
<?php $Archivo = '../config.xml'; if (file_exists($Archivo)) { $XML = simplexml_load_file($Archivo); foreach($XML as $Valor){ echo $Valor -> title; } } else { echo 'Error'; } ?>
y yo quisiera tomar estos valores del este xml
LINEA 12: <yweather:wind chill="28" direction="320" speed="4.83" />
LINEA 40: <yweather:forecast day="Thu" date="24 Apr 2008" low="14" high="31" text="Sunny" code="32" />
Código :
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <channel> <title>Yahoo! Weather - Bell Ville, AR</title> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Bell_Ville__AR/*http://weather.yahoo.com/forecast/ARCA2550_c.html</link> <description>Yahoo! Weather for Bell Ville, AR</description> <language>en-us</language> <lastBuildDate>Thu, 24 Apr 2008 12:00 pm ART</lastBuildDate> <ttl>60</ttl> <yweather:location city="Bell Ville" region="" country="AR"/> <yweather:units temperature="C" distance="km" pressure="mb" speed="kph"/> <yweather:wind chill="28" direction="320" speed="4.83" /> <yweather:atmosphere humidity="50" visibility="15" pressure="1010" rising="0" /> <yweather:astronomy sunrise="7:37 am" sunset="6:36 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com</link> <url>http://l.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif</url> </image> <item> <title>Conditions for Bell Ville, AR at 12:00 pm ART</title> <geo:lat>-32.62</geo:lat> <geo:long>-62.7</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Bell_Ville__AR/*http://weather.yahoo.com/forecast/ARCA2550_c.html</link> <pubDate>Thu, 24 Apr 2008 12:00 pm ART</pubDate> <yweather:condition text="Haze" code="21" temp="28" date="Thu, 24 Apr 2008 12:00 pm ART" /> <description><![CDATA[ <img src="http://l.yimg.com/us.yimg.com/i/us/we/52/21.gif"/><br /> <b>Current Conditions:</b><br /> Haze, 28 C<BR /> <BR /><b>Forecast:</b><BR /> Thu - Sunny. High: 31 Low: 14<br /> Fri - Sunny. High: 31 Low: 12<br /> <br /> <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Bell_Ville__AR/*http://weather.yahoo.com/forecast/ARCA2550_c.html">Full Forecast at Yahoo! Weather</a><BR/> (provided by The Weather Channel)<br/> ]]></description> <yweather:forecast day="Thu" date="24 Apr 2008" low="14" high="31" text="Sunny" code="32" /> <yweather:forecast day="Fri" date="25 Apr 2008" low="12" high="31" text="Sunny" code="32" /> <guid isPermaLink="false">ARCA2550_2008_04_24_12_00_ART</guid> </item> </channel> </rss><!-- api3.weather.sp1.yahoo.com compressed/chunked Thu Apr 24 10:23:50 PDT 2008 -->