/* Heise News Grabber 2.2 Copyright 2004 by MasterBootRecord.de - Matthias Zirngibl http://masterbootrecord.de/docs/heisenewsgrabber.php */ $ENABLE_CACHING = false; //Before you enable caching set the CACHE_FILE correctly... $CACHE_FILE = '/tmp/heisenews1.rdf'; //Where to store the cache file. HAVE TO BE WRITEABLE FOR THE USER-ACCOUNT OF THE WEBSERVER //$CACHE_FILE = 'c://temp//heisenews.rdf'; //For Windows $CACHE_REFRESH_TIME = 20; //Cache timeout in minutes $MAX_NEWS = 25; //If you want to restrict the headlines you can do it here if ($ENABLE_CACHING){ $cache_diff =(time() - @filemtime($CACHE_FILE))/60; if (!file_exists($CACHE_FILE) or ($cache_diff > 20) ){ $fcontents = join ('', @file ('http://www.heise.de/autos/rss/news.rdf')); @unlink($CACHE_FILE); $handle = @fopen($CACHE_FILE, 'x+'); @fwrite($handle, $fcontents); @fclose($handle); } $fcontents = join ('', @file ($CACHE_FILE)); } else { $fcontents = join ('', @file ('http://www.heise.de/autos/rss/news.rdf')); } $fcontents = str_replace ("", "", $fcontents); $fcontents = str_replace ("", "", $fcontents); $splices = explode ("
", $fcontents); if (count($splices) > $MAX_NEWS){ $stop_at = $MAX_NEWS; } else { $stop_at = count($splices); } $out_buffer = '
'; for ($i = 1; $i < $stop_at; $i++){ $link = explode("
",$splices[$i]); $splices1[$i] = $splices[$i]; $splices1[$i] = strip_tags($splices1[$i]); $splices1 = explode(" ",$splices1[$i]); //$splices1[$i] = substr($splices1[$i], -45, (len($splices1[$i])-45)); $splices[$i] = substr ($splices[$i], 0, 100); $link[1] = strip_tags($link[1]); $headline = str_replace ("
", '
', $splices[$i]); $headline = str_replace ("", "
", $headline); $headline = explode ("
", $headline); $headline = $headline[0]; $out_buffer = $out_buffer . $headline . '
'; } $out_buffer = $out_buffer . "
"; print $out_buffer; ?>