Monday, 23 December 2013

Fatal error: Call to undefined function: bcmod()

If you get this error in PHP Fatal error: Call to undefined function: bcmod() there is a simple fix which is hinted at on the PHP web site. Where you have $value = bcmod('4', '2'); replace with value = 4%2; This is a bodge, but a nice simple one.

Wednesday, 4 December 2013

How to show weather data from Davis Weather Station on a PHP web site part 2

See previous post for how to take the data from a Davis Vantage Vue and create a weather vane for your web site.

The code below will take the data from weatherlink.com  - see weatherlink, strip it of extraneous formatting and display it as a table on your web site like at Shanklin Sailing Club

Code is below.  It's all yours.




How to show weather data from Davis Weather Station on a PHP web site

Shanklin Sailing Club has a Davis Vantage Vue weather station attached to a pole which is 300 yards out to sea.  This connects wirelessly to a base station in the club house which is also connected to a Weatherlink IP. The Weatherlink IP takes the data and sends it to Weatherlink.com and Weather Underground.

Using PHP I have summarised this information in a table and as a weather vane.  The code for the weather vane is below.  You are welcome to use it on your own site.  Especially if you give me some credit.

Weather vane

http://www.shanklinsailingclub.com/weather-vane3.php

Make a file called weather-vane.php (or whatever) and link to it in the normal way with an img tag. You need to upload a font to the server and call it in the code below.