PHP receive script for KMTronic DS1820 LAN POST version module

 

 

Receive POST data using PHP

 

 



KMtronic LAN DS18B20 Temperature Monitor

 

 

LAN DS18B20 High-Precision 1-Wire Digital Temperature Monitor

 

 

 

 

 ------------------------------------------------------------------------------

 

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 .=  $temp2;
$current .= "\r\n";

// Write the contents back to the file
file_put_contents($file, $current);

// a:2:{s:9:"device_id";s:10:"B3D53A5348";s:11:"temperature";a:1:{s:18:"'282b91240700002e'";s:5:"15.43";}}

?>

 

 

DATA file:
20161229-00:00:21    1482962421    22.75
20161229-00:00:56    1482962456    22.75
20161229-00:01:30    1482962490    22.75
20161229-00:02:04    1482962524    22.75
20161229-00:02:38    1482962558    22.75
20161229-00:03:12    1482962592    22.75
20161229-00:03:46    1482962626    22.75
20161229-00:04:20    1482962660    22.75
20161229-00:04:54    1482962694    22.75
20161229-00:05:28    1482962728    22.81
20161229-00:06:02    1482962762    22.81
...
...
...
...
...

 

Read 1733 times