Skip to content

Instantly share code, notes, and snippets.

@adlerweb
Created February 15, 2015 03:51
ESP8266 -> Volkszäler
<?php
while(true) {
$html = file_get_contents('http://1.2.3.4/dht22.tpl');
if(preg_match('/temperature reading is ([\d\.]+)\*C, humidity is ([\d\.]+) ./', $html, $match)) {
vz_add('**UUID_TEMPERATUR**', $match[1]);
vz_add('**UUID_FEUCHTE**', $match[2]);
}
echo '--'."\n";
sleep(10);
}
function vz_add($id, $val) {
$url='http://vzserver/middleware.php/data/'.$id.'.json?operation=add&value='.$val;
var_dump($url);
$cmd = 'wget -O - '.escapeshellarg($url).' > /dev/null 2>/dev/null &';
exec($cmd);
}
?>
@adlerweb
Copy link
Author

19: wget über exec läuft asynchron, so blockt ein hängender Server nicht den kompletten Prozess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment