LAN DS18B20 WEB Temperature Monitor 1 meter Cable
www.WEB-Relays.com
www.Facebook.com/KMtronic

Receive UDP packet datagrams in PHP ( UDP server socket)

  PHP file: <?php $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);if (!$socket) { die(“socket_create failed.n”); }   //Set socket options.socket_set_nonblock($socket);socket_set_option($socket, SOL_SOCKET, SO_BROADCAST, 1);socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1); if (defined(‘SO_REUSEPORT’))socket_set_option($socket, SOL_SOCKET, SO_REUSEPORT, 1); //Bind to any address & port 12345.if(!socket_bind($socket, ‘0.0.0.0’, 12345))    die(“socket_bind failed.n”);   //Wait for data.$read = array($socket); $write = NULL; $except = NULL; while(socket_select($read, $write, . . .

Read More …

PHP receive script for KMTronic DS1820 LAN POST version module

  Receive POST data using PHP         PHP file: <?php $date = date(‘Ymd’); $time = date(‘H:i:s’); $hourtime = date(‘H:i’); $unixtime = time(); $file = “/var/www/html/data/”.$date.”.log”; $current = file_get_contents($file); $current .= $date; $current .= “-“; $current .= $time; $current .= “\t”; $current .= $unixtime; $current .= “\t”; $temp = $_POST[‘temperature’]; $temp2 = implode(“”,$_POST[‘temperature’]); $current . . .

Read More …

Create a Crontab server side PHP script for uploading temperature to a MySQL database

      Temperature Monitor STATUS XML data http://XXX.XXX.XXX.XXX/status.xml XXX.XXX.XXX.XXX is IP ADDRESS Temperature monitor     MySQL table     Cron is a system daemon used to execute desired tasks (in the background) at designated times.  A crontab file is a simple text file containing a list of commands meant to be run at . . .

Read More …

Reading Voltage from SDM120 Modbus Power Energy Meter using KMtronic TCPRS485 bridge via PHP

  Reading Voltage from SDM120 Modbus Power Energy Meter using TCP<>RS485 bridge via PHP. Bridge IP : 192.168.1.199 Bridge PORT : 9761 SDM120 Energy Meter Speed: 2400/8/N/1       PHP file <?php function hexTo32Float($strHex) { $v = ($strHex); $x = ($v & ((1 << 23) – 1)) + (1 << 23) * ($v >> 31 | 1); . . .

Read More …

PHP Scripts: Control KMtronic LAN WEB Relay board via PHP

  Ethernet Modbus IP 8 channels Modbus/TCP LAN Relay board   PHP code for STATUS Read WEB Relay board connected to IP: 192.168.1.199 PORT:80 USER: admin PASSWORD: admin     Create a new file. <?php $url = “http://192.168.1.199:80/status.xml”; $username = “admin”; $password = “admin”; //open connection $ch = curl_init(); //set the url, number of POST vars, . . .

Read More …

KMtronic LAN WEB 8 Channel Relay board