Thursday, July 29th, 2010

Weather Script
Root page of JMan's Bedpan
A short little bio of JMan and JMan's Bedpan
Some PHP scripts that JMan has written, for public use. MSN Emoticons, Weather, Webcam, Latest Version, Cache, HotScripts
Other random stuff that doesnt belong on any other page. Family Feud Cheat, I *Heart* James, Stupidest Famous Last Words, Funny Search Engine Queries, Funny Euphemisms
Rants by Blakey
A bunch of useful links
. : : Local Weather Forecast

This magnificent piece of code leeches weather information off of Environment Canada's weather page, and displays it in a nice format on your own website.

VERSION 2 HAS BEEN RELEASED Weather Script v.2


Explanations:

#.gif - All the different weather image files.
index.php - A redirecting index page to prevent directory viewing.
cache.php - Allows for caching of the fetched information, for quicker results, and less drag on HotScripts.
gpl.txt - A copy of the General Public License.
readme.txt - A quick readme file.
SQL.sql - The SQL table.
weather.php - The script page. Include it in the page you want the weather displayed on, then call its functions.


EXAMPLE: (Not current, just an example of the format)

<?
include ("weather.php");
?>
Monday Tuesday Wednesday Thursday Friday
Blowing Snow Showers or Flurries Mainly Sunny Ice Crystals Clearing
High -1 °C
POP 20%
Low -5 °C
POP 60%
High 22 °C
Low 14 °C
High -7 °C
Low -12 °C
POP 50%
Low 6 °C
Blowing Snow Showers or Flurries Mainly Sunny Ice Crystals Clearing


-- DOWNLOAD --
1290 Downloads To Date

HotScripts.com
Rating: Not Yet Rated / 5
Votes: 0
Hits: 0

LASTEST UPDATES:
October 20, 2006
Updated to all the latest weathericons.

March 2, 2006
Added missing #35 'Clearing' image.

January 31, 2006
Updated with the lastest icons from Environment Canada's Website, and changed the example to actual possible results.

January 18, 2006
Updated with the lastest version of the Cache script.

December 29, 2005
Weather information is now cached to a MySQL database for one hour, to speed up the process, save bandwidth, and be kinder to the weather server.

[Show All 11 Comments]

Daniel Hendrawan
08/27/2006 11:08 PM
I hv to try this script in www.alphabetha.com/weather/weather.php but i hv error is :
"Warning: file_get_contents(): URL file-access is disabled in the server configuration in /home/sloki/user/t32096/sites/alphabetha.com/www/weather/weather.php on line 25

Warning: file_get_contents(http://www.weatheroffice.ec.gc.ca/forecast/city_e.html?on-82&unit=m&b_templatePrint=true): failed to open stream: no suitable wrapper could be found in /home/sloki/user/t32096/sites/alphabetha.com/www/weather/weather.php on line 25".

So i can to be try with .html in www.alphabetha.com/weather.html with format :
"<body>
<?
location ("weather/weather.php");
?> "
BUT i saw the blanked screen.

Would you please to help us ?, please send by email to daniel@hendrawan.com

Thank for your attention.
JMan: If your web host has URL functions disabled, there isn't anything I can tell you. The script will not run without it. A possible workaround might be if they have cURL enabled, you can patch the script using cURL functions.
Email your administrator / customer support, and ask them what you can do.

tippy
08/16/2006 01:34 AM
I love this script! I'm going to try and make it display more then one city...wish me luck.

When are you going to put your "Add a Comment" script (complete with verification) online for us to download? (please!!!!)
JMan: I actually have a new version of the weather script nearly ready for release. It would allow easily showing multiple cities, amoung several other features, some of which being multiple display formats, showing current information, better reliability, many more customizations, to name a few. Check back often.

And I haven't even considered releasing my comment script. I'll have to think about it.

Dan
07/20/2006 03:16 PM
Is there a way to limit to 1 day of weather ?
JMan: If I understand what you're trying to do properly, and you want the script to cache the weather information only once per day, instead of once every hour, all you have to do is change line 46 in weather.php from:
cache("weather", 3600, $matches);
to:
cache("weather", 86400, $matches);
The number in that line reprents the minimum amount of seconds to cache the data for.
60 Seconds x 60 Minutes x 24 Hours = 86400 Seconds in a Day.
Hope that helps.

Washington
07/17/2006 04:52 PM
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id' ('id')
) ENGINE=MyISAM DEFAULT CHARSET=latin1' at line 5

I have tried modifications your suggested for somebody else who has had the same problem but it does not work, I have MySQL 5.0
any new advise?

Regards
Washington
JMan: Try this:
CREATE TABLE IF NOT EXISTS 'cache' (
'id' varchar(25) NOT NULL,
'stored' text NOT NULL,
'timestamp' int(11) NOT NULL,
UNIQUE KEY 'id' ('id')
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Note the added comma ',' after the timestamp line.

surfer
06/17/2006 04:49 PM
thanks for the effort. maybe something is wrong with your server or folder permissions. the zip file was corrupted. i checked it on 3 different pcs on 3 different networks on 2 different OS's. even this new zip is corrupt and fails CRC checks while unzipping. Maybe your compression software is having some problem somewhere. Maybe these tips would do: Try winzip (free for evaluation) or even better WinRAR. Try to rename the folder all in small. Test the zip yourself by a download to see if it opens fine. anyways all it was missing were some graphics that can easily be downloaded from other site. Very nice script thanks.
JMan: Problem has been resolved. I still don't know what the cause was, but some part of my server wasn't letting me send ZIP files properly. The files are fine server-side, but once they were downloaded, they got messed up somewhere in the process. I reinstalled each part of my webserver, and after that did nothing, I wrote a script to fix the problem.

[Show All 11 Comments]

Add a Comment (Max: 1 Per Hour)

Please make sure that your comment pertains to this page. If it has nothing to do with this page, I'll just delete it. If you want, you can send me an email here: jman@bedpan.ca.

Name :
Email or URL :
Verification :
All fields are required for submission. Entries with blank fields will not be posted.

disclaimer:
the comments posted throughout my site are submitted by other users.
the things said are not endorsed by me, and do not represent my opinion.