$ss) $ret= true; $sr= date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $lat, $long, $zenith); if (time() < $sr) $ret= true; //Daten holen $array = []; $data=file_get_contents("http://www.meteopassione.com/sito/d-stazione.php?id=150"); $pattern = "/Stazione meteo di Campione del Garda aggiornamento del (\d\d).?(\d\d).?(\d\d).*\n.*(\d)/"; preg_match_all($pattern, $data, $array); //$time = mktime($array[4][0],$array[5][0],00,$array[2][0],$array[1][0],'20'.$array[3][0]); //SQL Connect $dbhost = 'localhost'; $dbuser = 'addictedmysql'; $dppass = 'WAvQ4hpAS5m73vQ6'; $conn = mysqli_connect($dbhost, $dbuser,$dppass) or die ('Error connecting to mysql'); $dbname = 'addicted'; mysqli_select_db($conn,$dbname); /* //prüfen ob Daten bereits in der Datenbank $schonda=mysqli_query($conn,"SELECT * FROM `tx_webcam_wetter` where tstamp=".$time." and pid=447"); if (!$schonda) { echo(date("d.m.y H:i:s").' Ungültige Select Abfrage: '.mysqli_error()."\n"); mysqli_close($conn); exit; } $row = mysqli_fetch_assoc($schonda); if ($row['uid'] > 0){ echo(date("d.m.y H:i:s").' Eintrag schon vorhanden '.$row['uid']."\n"); mysqli_close($conn); exit; } */ $array = []; $patter = "/Temperatura.*\n.*\n.*\n.*(.\d\.\d)/"; preg_match_all($patter, $data, $array) ; $temp = $array[1][0]; $array = []; $patter = "/Umidità.*\n.*\n.*\n.*(.\d)/"; preg_match_all($patter, $data, $array) ; $feuchte = $array[1][0]; $array = []; $patter = "/Indice di raffreddamento.*\n.*\n.*\n.*(.\d.\d)/"; preg_match_all($patter, $data, $array) ; $water = $array[1][0]; $array = []; $patter = "/Pressione atmosferica.*\n.*\n.*\n.*(.\d\d\d.\d)/"; preg_match_all($patter, $data, $array) ; $druck = $array[1][0]; $array = []; $patter = "/Vento.*\n.*\n.*\n.*(.\d.\d)\n(.*km.h - (\w?\w?\w?))/"; $patter = "/Vento.*\n.*\n.*\n.*(.\d.\d)/"; preg_match_all($patter, $data, $array) ; $wind = $array[1][0]; //$dirStr = $array[3][0]; //$dirInt = windDirectionFromStrToInt($dirStr); /* $result= mysqli_query($conn,"INSERT INTO tx_webcam_wetter(pid,tstamp,crdate,cruser_id,tempin,tempout,dp,rhi,rho,ws,wc,r1h,r24h,rtot,rp,dir0,minws,maxws) VALUES ('447','$time','$time','2','0',$temp,'0','0','$feuchte','0','0','0','0','0','$druck','$dirInt','$wind','$wind')"); mysqli_close($conn); */ $wind=round($wind*0.539956803,2); //bei Wind - Windfile anlegen Interval = 300 if (($wind>15) and $ret==false){ exec("touch $windfile"); echo (date("d.m.y H:i:s")." Es hat Wind! \n"); } $windMessungFile=fopen($wetterPath."wind.txt", "w"); $tempMessungFile=fopen($wetterPath."temp.txt", "w"); //$wassertempMessungFile=fopen($wetterPath."wassertemp.txt", "w"); $maxMessungFile=fopen($wetterPath."max.txt", "w"); $dirMessungFile=fopen($wetterPath."dir.txt", "w"); $dirStrMessungFile=fopen($wetterPath."dirStr.txt", "w"); //fwrite($wassertempMessungFile,$water); fwrite($dirMessungFile,$dirInt); fwrite($maxMessungFile,$wind); fwrite($tempMessungFile,$temp); fwrite($windMessungFile,"$wind-$wind"); fwrite($dirStrMessungFile,$dirInt); //fclose($wassertempMessungFile); fclose($tempMessungFile); fclose($windMessungFile); fclose($maxMessungFile); fclose($dirMessungFile); echo(date("d.m.y H:i:s")." OK!.\n"); ?>