Foros del Web » Programando para Internet » PHP »

leer rss de yahoo clima

Estas en el tema de leer rss de yahoo clima en el foro de PHP en Foros del Web. este es el xml del rss de yahoo clima: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <rss version="2.0" xmlns:yweather="http://weather.yahooapis.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <channel> <title>Yahoo! Weather - Sunnyvale, CA</title> <link> ...
  #1 (permalink)  
Antiguo 01/03/2008, 16:46
 
Fecha de Ingreso: abril-2003
Ubicación: Córdoba
Mensajes: 160
Antigüedad: 21 años
Puntos: 0
Pregunta leer rss de yahoo clima

este es el xml del rss de yahoo clima:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<rss version="2.0" xmlns:yweather="http://weather.yahooapis.com/ns/rss/1.0"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<title>Yahoo! Weather - Sunnyvale, CA</title>
<link>http://us.rd.yahoo.com/dailynews/rss...Sunnyvale__CA/
*http://xml.weather.yahoo.com/forecast/94089_f.html</link>
<description>Yahoo! Weather for Sunnyvale, CA</description>
<language>en-us</language>
<lastBuildDate>Tue, 29 Nov 2005 3:56 pm PST</lastBuildDate>
<ttl>60</ttl>
<yweather:location city="Sunnyvale" region="CA" country="US"></yweather:location>
<yweather:units temperature="F" distance="mi" pressure="in" speed="mph"></yweather:units>
<yweather:wind chill="57" direction="350" speed="7"></yweather:wind>
<yweather:atmosphere humidity="93" visibility="1609" pressure="30.12" rising="0"></yweather:atmosphere>
<yweather:astronomy sunrise="7:02 am" sunset="4:51 pm"></yweather:astronomy>
<image>
<title>Yahoo! Weather</title>
<width>142</width>
<height>18</height>
<link>http://weather.yahoo.com/</link>
<url>http://us.i1.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif</url>
</image>
<item>
<title>Conditions for Sunnyvale, CA at 3:56 pm PST</title>
<geo:lat>37.39</geo:lat>
<geo:long>-122.03</geo:long>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/
<span style="font-size: 0px"> </span>Sunnyvale__CA/*
<span style="font-size: 0px"> </span>http://xml.weather.yahoo.com/<span style="font-size: 0px"> </span>forecast/94089_f.html
</link>
<pubDate>Tue, 29 Nov 2005 3:56 pm PST</pubDate>
<yweather:condition text="Mostly Cloudy" code="26" temp="57" date="Tue, 29 Nov 2005 3:56
pm PST"></yweather:condition>
<description><![CDATA[
<img src="http://us.i1.yimg.com/us.yimg.com/i/us/we/52/26.gif" /><br />
<b>Current Conditions:</b><br />
Mostly Cloudy, 57 F<p />
<b>Forecast:</b><BR />
Tue - Mostly Cloudy. High: 62 Low: 45<br />
Wed - Mostly Cloudy. High: 60 Low: 52<br />
Thu - Rain. High: 61 Low: 46<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://xml.weather.yahoo.com/forecast/94089_f.html">Full Forecast at Yahoo! Weather</a><BR/>
(provided by The Weather Channel)<br/>]]>
</description>
<yweather:forecast day="Tue" date="29 Nov 2005" low="45" high="62" text="Mostly Cloudy"
code="27"></yweather:forecast>
<yweather:forecast day="Wed" date="30 Nov 2005" low="52" high="60" text="Mostly Cloudy"
code="28"></yweather:forecast>
<guid isPermaLink="false">94089_2005_11_29_15_56_PST</guid>
</item>
</channel>
</rss>


Yo lo unico que quiero obtener con php y guardarlo en dos variables, es la Url de la imagen,
<image>
<title>Yahoo! Weather</title>
<width>142</width>
<height>18</height>
<link>http://weather.yahoo.com/</link>
<url>http://us.i1.yimg.com/us.yimg.com/i/.../main_142b.gif</url>
</image>

y el valor de la temperatura:
<yweather:condition text="Mostly Cloudy" code="26" temp="57" date="Tue, 29 Nov 2005 3:56
pm PST"></yweather:condition>

Alguien me puede decir que puedo hacer?
Saludos
__________________
-----------------
_
__|_|__
º(-_-)º
  #2 (permalink)  
Antiguo 01/03/2008, 18:51
(Desactivado)
 
Fecha de Ingreso: diciembre-2006
Mensajes: 225
Antigüedad: 17 años, 4 meses
Puntos: 1
Re: leer rss de yahoo clima

a mi tbn me serviria de mucho yo estaba usando simplexml pero me sale un error buscamos la ayuda de gatorV
  #3 (permalink)  
Antiguo 01/03/2008, 19:08
Avatar de eddwinpaz  
Fecha de Ingreso: noviembre-2007
Ubicación: Merida , Venezuela
Mensajes: 1.066
Antigüedad: 16 años, 5 meses
Puntos: 25
Re: leer rss de yahoo clima

exacto parsea el XML y lo puedes hacer usando simpleXML y para poder manipular mejor las etiquetas usa Javascript o simplemente PHP y HTML.
  #4 (permalink)  
Antiguo 02/03/2008, 12:30
 
Fecha de Ingreso: abril-2003
Ubicación: Córdoba
Mensajes: 160
Antigüedad: 21 años
Puntos: 0
Re: leer rss de yahoo clima

El problema es que simpleXML es de php5 y yo necesito hacerlo con php4....
Yo quiero extraer esos dos datos limpios para mostralos con php nada mas....
__________________
-----------------
_
__|_|__
º(-_-)º
  #5 (permalink)  
Antiguo 02/03/2008, 12:47
Avatar de eddwinpaz  
Fecha de Ingreso: noviembre-2007
Ubicación: Merida , Venezuela
Mensajes: 1.066
Antigüedad: 16 años, 5 meses
Puntos: 25
Re: leer rss de yahoo clima

Bueno migra simpleXML a php4 no son grandes cambios que hayan hecho.. salu2 o sino simplemente trabaja el XML con javascript directo y te salvas una morena de tiempo ....
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:39.