Jump to content

[SOLVED] Weather RSS


jaymc

Recommended Posts

This may be something for U.K based people on here can answer

 

I am looking for a website that has some kind of text feed, maybe RSS to give me

the weather forcast

 

I must be able to filter by location using a UK postcode

 

Does anyone know where I can find a service like this?

Link to comment
https://forums.phpfreaks.com/topic/118067-solved-weather-rss/
Share on other sites

A few months ago, I put together a tutorial which allowed mobile users to query the current and forecast weather of a specific area using SMS (tutorial's here).

 

I began the tutorial on the same premis as your application (i.e. being able to query by post code), but then found out the tutorial was for French readers in which the UK post code system would be of no use. Although I ended up changing the article to meet their needs, here is the logic of how I would have done it for UK...

 

1. Visit http://en.wikipedia.org/wiki/List_of_postcode_areas_in_the_United_Kingdom and use the list to create an associative array, csv file or an xml file which can be used to translate area codes to area names.

 

2. Visit http://weather.yahoo.com/regional/UKXX.html and trace down the areas you extracted in #1. When you hover over each area, you will see a code show in the final part of your browser's address bar. For example, the code for Abbey is UKXX1294.

 

3. When someone queries a post code, such as W14 or W14 8DS, use a regular expression or other method to identify the first letter.

 

4. Translate the letter into an area name and the area name into a Yahoo API area code and query the Yahoo API with that. So, if you need the weather for W14 7ET, you would extract the W, identify that as being London, identify the Yahoo code as being UKXX0085 and query its API using http://weather.yahooapis.com/forecastrss?p=UKXX0085&u=c

 

(Lastly, be sure to use Arash Hemmat's Yahoo weather component to avoid re-inventing the wheel.)

 

I hope that all helps. Good luck.

Link to comment
https://forums.phpfreaks.com/topic/118067-solved-weather-rss/#findComment-608305
Share on other sites

If you need a 5 day forecast, I used: http://weather.msn.com/

 

They have international feeds and the images are very clean and modern looking compared to some of the other feeds I used.  I just parsed out the XML into a styled table and my users simply entered their zipcode into a custom profile field in SMF.  Granted, my user base was only in the US, but it should handle codes from around the world.

Link to comment
https://forums.phpfreaks.com/topic/118067-solved-weather-rss/#findComment-608587
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.