Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

commented Feb 15, 2015

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
You can’t perform that action at this time.