Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.