Created
February 15, 2015 03:51
ESP8266 -> Volkszäler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
19: wget über exec läuft asynchron, so blockt ein hängender Server nicht den kompletten Prozess