Question

I want to weather information in my website which should be autometically updated daily could you please help me script for weather information?

Was it helpful?

Solution

Go to Weather.com and sign up for a Weather Widget. This is a javascript script that you'll place on your page and is independent of the server side language used. Note also that you won't have to update the weather daily at all: the script will always just pull the current weather forecast. You will have to provide information about the area for which you want weather (e.g. zip/postal code).

OTHER TIPS

I made a Weather API available on mashape, and they have a ready to use simple PHP SDK. This api is really simple to use because we use the cool standards that are available nowadays, like JSON and REST.

If you like it please give it a try on mashape

If you want data automatically updated on a schedule, look into cron (on Unix systems) or its equivalent. If you're using a commercial web host, they should have a way to schedule programs; otherwise, look into your own system's documentation for scheduling scripts.

Next, you want to write a script that downloads the weather information at that moment. Allow this script to translate from the "source" format to your own format.

Have the scheduler run your script once a day.

An alternative to Weather.com is Weather Underground. This is a successful weather forecasting site that cover most of the world (you don't say where you need the forecast for). They have something free called Weather Stickers which offer live feeds of the current observed weather situation. You just embed an image in your page. Like this:

Click for London, United Kingdom Forecast
(source: wunderground.com)

They also offer weather forecast XML feeds and API.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top