Fetching weather information from Yahoo.com

May 26, 2006

For fetching weather information for Mumbai region make a HTTP GET request at http://xml.weather.yahoo.com/forecastrss with request parameters as:

Parameter Description Example
p US zip code or Location ID. p=95089
u Units for temperature.
f: Fahrenheit
c: Celsius

So for Mumbai  region query p=INXX0087 and u=c


 In response to this request you'll get a XML data containing following elements:

<?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#">


  <title>Yahoo! Weather – Mumbai, IN</title>




  <description>Yahoo! Weather for Mumbai, IN</description>


  <lastBuildDate>Fri, 26 May 2006 12:10 pm IST</lastBuildDate>


  <yweather:location city="Mumbai" region="" country="IN" />

  <yweather:units temperature="C" distance="km" pressure="mb" speed="kph" />

  <yweather:wind chill="32" direction="290" speed="14" />

  <yweather:atmosphere humidity="55" visibility="800" pressure="0" rising="2" />

  <yweather:astronomy sunrise="6:01 am" sunset="7:10 pm" />


  <title>Yahoo! Weather</title>







  <title>Conditions for Mumbai, IN at 12:10 pm IST</title>






  <pubDate>Fri, 26 May 2006 12:10 pm IST</pubDate>

  <yweather:condition text="Partly Cloudy" code="30" temp="32" date="Fri, 26 May 2006 12:10 pm IST" />


<![CDATA[ <img src="http://us.i1.yimg.com/us.yimg.com/i/us/we/52/30.gif&quot; /><br />
<b>Current Conditions:</b><br />
Partly Cloudy, 32 C<BR /><BR />
<b>Forecast:</b><BR />
  Fri – Partly Cloudy. High: 31 Low: 28<br />
  Sat – Scattered Thunderstorms. High: 30 Low: 27<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/


INXX0087_c.html">Full Forecast at Yahoo! Weather</a><BR/>
(provided by The Weather Channel)<br/>   ]]> f(clean);


  <yweather:forecast day="Fri" date="26 May 2006" low="28" high="31" text="Partly Cloudy" code="30" />

  <yweather:forecast day="Sat" date="27 May 2006" low="27" high="30" text="Scattered Thunderstorms" code="38" />

  <guid isPermaLink="false">INXX0087_2006_05_26_12_10_IST</guid>




<!–  p5.weather.dcn.yahoo.com uncompressed Fri May 26 00:35:37 PDT 2006   –> f(clean);

Now the things are bit simple, get a XML reader to read all the required child nodes from the feed.

You need to develop an application which makes a HTTP request and get the XML response.



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: