#
Winterdienst in Berlin
".$html->find('div[class="blockBodyFliesstext"] h2', 0)->plaintext.""; $cnt = count($html->find('div[class="blockBodyFliesstext"] p')); $i = 0; foreach($html->find('div[class="blockBodyFliesstext"] p') as $p) { if($i<$cnt-1) { $body .= "

".$p->plaintext."

\n"; } $i++; } $html->clear(); unset($html); $hhtml = $title."\n".$body; return $hhtml; } function gen() { global $wf_path; $f = $wf_path."text_cached/wetterbericht.txt"; $handle = fopen($f, "r"); $contents = fread($handle, filesize($f)); fclose($handle); $html = get_dwd(); $handle = fopen($f, 'w'); $new_content = $html; fwrite($handle, $new_content); fclose($handle); $f_date = $wf_path."text_cached/wetterbericht_date.txt"; $handle_date = fopen($f_date, 'w'); fwrite($handle_date, mktime(date("H")+1, 0, 0, date("n"), date("j"), date("Y"))); fclose($handle_date); } function read($contents) { echo $contents; echo '


Quelle: © DWD - Deutscher Wetterdienst

'; } function start() { global $wf_path; $f = $wf_path."text_cached/wetterbericht.txt"; $handle = fopen($f, "r"); $contents = fread($handle, filesize($f)); $f_date = $wf_path."text_cached/wetterbericht_date.txt"; $handle_date = fopen($f_date, "r"); $contents_date = fread($handle_date, filesize($f_date)); $cur_ts = mktime(); // echo $cur_ts." > ".$contents_date; // echo mktime(23, 59, 59, date("n"), date("j")-1, date("Y")); if($cur_ts > $contents_date) { gen(); read($contents); } else { read($contents); } } start(); ?>