They're free, but use at your own risk
The scripts referenced here are used in the operation of this weather station, and may be freely copied and used to support your station. Please note that you use these scripts at your own risk. No warranty is expressed or implied. I accept no liability for any damages that may ensue from their use.
You will need to configure them for your own particular weather station website.
A RSS Feed is available to help keep you informed on updates to the scripts.
A Version History is available -- check back from time to time to see if there are updates to scripts you have downloaded earlier.
Announcements of version updates and new scripts are made on
WXForum.net and
Weather-Watch forums
and saratogaWXPHP Twitter account as they become available.
This page was updated
Wednesday, 02-Sep-2009 9:38 AM
PHP Scripts (run on webserver)
These scripts have run on PHP 4.1.2, and PHP 4.4.1. I don't have access to PHP 3.x, so it is not known if they will work on versions below PHP 4.1.2. If you try them and they work (or not) on earlier versions of PHP, please send me a message at webmaster[at]saratoga-weather.org and let me know the results.
Recent nearby earthquakes (from USGS, NRC, BGS) PHP
Here in California, we're a bit sensitive to the earth moving (it happens a lot), so I wrote a PHP page to get, cache and reformat the last 7 days of earthquake information so it can be included on the website with links to additional info.
The output of these scripts is XHTML 1.0-Strict compliant. All of them use the same style for inclusion into your webpage as shown in the example below.
Here is a live example using quake-CANV.php):
<?php $doIncludeQuake = true; include("quake-CANV.php); ?>
produces the following:
| Earthquakes of magnitude 2.0 or greater within 150 miles |
| Update time = Fri, 03-Feb-2012 5:41pm PST |
| Near City | Magnitude | Distance to Epicenter | Local Time | Link to Map |
| 3 km ( 2 mi) WNW of Anderson Springs, CA |
2.2 |
111 mi (179 km) |
Fri, 03-Feb-2012 4:00pm PST |
map |
| 10 km ( 6 mi) SE of Pinnacles, CA |
2.1 |
77 mi (124 km) |
Thu, 02-Feb-2012 9:08pm PST |
map |
| 5 km ( 3 mi) WNW of Anderson Springs, CA |
2.6 |
112 mi (180 km) |
Thu, 02-Feb-2012 11:15am PST |
map |
| 3 km ( 2 mi) NE of The Geysers, CA |
2.0 |
114 mi (184 km) |
Thu, 02-Feb-2012 8:54am PST |
map |
| 10 km ( 6 mi) NE of Cloverdale, CA |
2.2 |
121 mi (195 km) |
Thu, 02-Feb-2012 6:15am PST |
map |
| 2 km ( 1 mi) NE of The Geysers, CA |
2.1 |
115 mi (184 km) |
Wed, 01-Feb-2012 6:23pm PST |
map |
| 7 km ( 4 mi) NNW of Aromas, CA |
2.1 |
30 mi (48 km) |
Wed, 01-Feb-2012 5:48am PST |
map |
| 2 km ( 1 mi) NNE of The Geysers, CA |
2.0 |
114 mi (184 km) |
Wed, 01-Feb-2012 5:26am PST |
map |
| 11 km ( 7 mi) SE of Pinnacles, CA |
2.6 |
77 mi (124 km) |
Wed, 01-Feb-2012 4:21am PST |
map |
| 3 km ( 2 mi) NE of The Geysers, CA |
2.1 |
115 mi (185 km) |
Wed, 01-Feb-2012 1:06am PST |
map |
| 17 km (11 mi) WNW of Cantua Creek, CA |
2.0 |
97 mi (157 km) |
Mon, 30-Jan-2012 11:26pm PST |
map |
| 3 km ( 2 mi) S of Alamo, CA |
2.2 |
39 mi (62 km) |
Mon, 30-Jan-2012 10:56pm PST |
map |
| 3 km ( 2 mi) WNW of Saratoga, CA |
2.1 |
2 mi (3 km) |
Mon, 30-Jan-2012 4:00am PST |
map |
| 2 km ( 2 mi) NNE of The Geysers, CA |
3.0 |
115 mi (185 km) |
Sun, 29-Jan-2012 7:57pm PST |
map |
| 3 km ( 2 mi) NNE of The Geysers, CA |
3.1 |
115 mi (186 km) |
Sun, 29-Jan-2012 7:56pm PST |
map |
| 2 km ( 1 mi) N of The Geysers, CA |
2.6 |
115 mi (185 km) |
Sat, 28-Jan-2012 4:41pm PST |
map |
| 15 km ( 9 mi) N of Cayucos, CA |
2.5 |
133 mi (214 km) |
Sat, 28-Jan-2012 10:50am PST |
map |
| 6 km ( 4 mi) SW of Upper Lake, CA |
2.0 |
138 mi (222 km) |
Fri, 27-Jan-2012 10:10pm PST |
map |
Click on location for more details from the USGS.
The California/Nevada earthquake script : demo and download [ see version history ]
Documentation on how to customize the script is in comments contained in the source. For anywhere in California or Nevada, you just have to change $myLat and $myLong to your station's decimal latitude and longitude to see it work in your area. Defaults are for magnitude 2.5 (or greater) within a 150 mile radius.
The Canada earthquake script : demo and download [ see version history ]
Documentation on how to customize the script is in comments contained in the source. For anywhere in Canada, you just have to change $myLat and $myLong to your station's decimal latitude and longitude to see it work in your area. Defaults are for magnitude 2.0 (or greater) within a 500 km radius. This script uses data from Natural Resources Canada website and returns earthquake activity over the last 30 days. Version 1.03 now provides both English and French display.
The UK earthquake script : demo and download [ see version history ]
Documentation on how to customize the script is in comments contained in the source. For anywhere in the United Kingdom, you just have to change $myLat and $myLong to your station's decimal latitude and longitude to see it work in your area. Defaults are for earthquakes within a 500 km radius. This script uses data from British Geological Survey website and returns earthquake activity over the last 30 days.
BGS data is used with permission as long as the attribution built into the script displays with the script output.
The USA earthquake script : download [ see version history ]
Documentation on how to customize the script is in comments contained in the source. This script uses the USGS USA website, and has the last 7 days of earthquakes 1.0+ in magnitude for the lower 48 states, Alaska, Hawaii, parts of lower Canada, parts of upper Mexico and areas near Puerto Rico.
Demo for quakes near:
Saratoga, CA |
Hilo, Hawaii |
Anchorage, AK |
Seattle, WA |
St. Louis, MO |
San Juan, Puerto Rico
The WORLD earthquake script : download [ see version history ]
Documentation on how to customize the script is in comments contained in the source. This script uses the USGS world website and has the last 7 days of earthquake data.
For the USA (48 lower states, Alaska, Hawaii, Puerto Rico) it has data on 2.5+ magnitude
earthquakes.
For non-USA locations it has data on 4.0+ magnitude earthquakes.
Demo for quakes near:
Grahams Beach, NZ |
Tokyo, Japan |
Mexico City, Mexico |
Tehran, Iran |
Jakarta, Indonesia |
Athens, Greece
In addition to the $myLat and $myLong changes, you will need to customize the scripts with the timezone information for your location. The source for each of the scripts has information on how to do this, and you can use this timezone name table to help select the correct zone name.