Home >> download wrapper

Please report any bugs you encounter on the discussion board at the Google Group. I have tested all of the methods but that doesn't mean everything is perfect, so I would really appreciate feedback to improve the wrapper for the whole community.

download links

requirements

  • PHP 4.3 or higher (including PHP 5)
  • MySQL if you choose to enable caching
  • SimplePie if you use an RSS function

mysql caching

The wrapper supports caching using a mysql database (highly recommended for increased performance). Also, caching provides redudancy of the WeatherBug call fails, the wrapper will fallback to a cached version if it exists. It is enabled by default and you must connect to the database in PHP before calling any methods in the wrapper. The default table structure used: DROP TABLE IF EXISTS `WB_cache`; CREATE TABLE `WB_cache` ( `request` varchar(35) collate utf8_bin NOT NULL, `response` mediumtext collate utf8_bin NOT NULL, `time` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`request`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; You can modify the table name and default cache time (15 minutes) in the wrapper. They are both constants defined at the beginning of the file.

basic usage

Very simple file to show the most basic usage: <?php // Change to path of WBWrapper.inc require_once('WBWrapper.inc'); /* Change this to your API Key Also, we disabled caching with the second parameter because we have not connected to a database */ $wb = new WBWrapper('APIKEY', false); if (($forecast = $wb->wb_forecast(array('zipCode'=>90210), 0)) !== false) { foreach($forecast['days'] as $day){ print_r($day); } } else { echo "An Error Occured: {$wb->lastError}"; } ?>

license

Copyright (c) 2008 Brady Emerson.  All rights reserved.

Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither my name nor the names of contributors may be used 
  to endorse or promote products derived from this software without specific prior 
  written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.