Free PHP
Yahoo Weather Class!
1) WHAT IT IS?!
2) DEMO
The demo is available by clicking on the following link! This test script shows you all attributes, that the class delivers!
http://www.voegeli.li/development/class.yahoo.weather/weather.test.php
(new window)
3) DOWNLOAD
Download the file from one of the following locations:
http://www.voegeli.li/development/class.yahoo.weather/class.yahoo.weather.rar
4) USAGE EXAMPLE (VERY EASY)
5) METHODS
The following methods are provided by the class.
Method | Description |
Constructor Method: object = new weather("CIXX0020", 3600, "C");
|
This is the constructor method, automatically called, when you make the instance. There are 3 Parameters you have to pass:
|
parse() | This method parses the weather data from RSS every call!!! That means every time, when you call this method, the weather data are refreshed from the RSS from weather.yahoo.com. This may be very slow (needs every hit a connection to the Yahoo server!). NOT RECOMMENDED |
parsecached() | This method parses the RSS only if needed! That means it looks on your local server, if there's a valid object cache file (named like the location code). If there is no cached version, it automatically parses the object from RSS weather.yahoo.com, writes the object with a specified lifetime down to your local server! Very enhanced! Very usefull and VERY FAST!! RECOMMENDED!!! |
6) ATTRIBUTES
Here is the complete list of the class attributes with a description:
Attribute | Description |
locationtext | (unused) |
locationcode | The location code from weather.yahoo.com |
allurl | RSS URL (full) |
title | Text from Yahoo (Yahoo! Weather - Santiago, CI) |
city | City (Santiago) |
sunrise | Time of sunrise |
sunset | Time of sunset |
yahoolink | Link to the actual forecast details on weather.yahoo.com |
acttext | Actual Situation: Text |
acttemp | Actual Situation: Temperature |
acttime | Actual Situation: Time of measure |
imageurl | Actual Situation: Logo from yahoo |
actcode | Actual Situation: Weather code (see testscript images!) |
fore_day1_day (DAY1) | Forecast: Day ("Wed", "Thu"...) |
fore_day1_date | Forecast: Date |
fore_day1_tlow | Forecast: Temp low (night) |
fore_day1_thigh | Forecast: Temp high (day) |
fore_day1_text | Forecast: Text |
fore_day1_imgcode | Forecast: Weather code (see testscript images!) |
fore_day2_day (DAY2) | Forecast: Day ("Wed", "Thu"...) |
fore_day2_date | Forecast: Date |
fore_day2_tlow | Forecast: Temp low (night) |
fore_day2_thigh | Forecast: Temp high (day) |
fore_day2_text | Forecast: Text |
fore_day2_imgcode | Forecast: Weather code (see testscript images!) |
fore_day3_day (DAY3) | Forecast: Day ("Wed", "Thu"...) |
fore_day3_date | Forecast: Date |
fore_day3_tlow | Forecast: Temp low (night) |
fore_day3_thigh | Forecast: Temp high (day) |
fore_day3_text | Forecast: Text |
fore_day3_imgcode | Forecast: Weather code (see testscript images!) |
fore_day4_day (DAY4) | Forecast: Day ("Wed", "Thu"...) |
fore_day4_date | Forecast: Date |
fore_day4_tlow | Forecast: Temp low (night) |
fore_day4_thigh | Forecast: Temp high (day) |
fore_day4_text | Forecast: Text |
fore_day4_imgcode | Forecast: Weather code (see testscript images!) |
fore_day5_day (DAY5) | Forecast: Day ("Wed", "Thu"...) |
fore_day5_date | Forecast: Date |
fore_day5_tlow | Forecast: Temp low (night) |
fore_day5_thigh | Forecast: Temp high (day) |
fore_day5_text | Forecast: Text |
fore_day5_imgcode | Forecast: Weather code (see testscript images!) |