$ENABLE_CACHING = false; //Before you enable caching set the CACHE_FILE correctly...
$CACHE_FILE = 'http://cert.uni-stuttgart.de/ticker/rus-cert.rdf'; //Where to store the cache file. HAVE TO BE WRITEABLE FOR THE USER-ACCOUNT OF THE WEBSERVER
//$CACHE_FILE = 'http://cert.uni-stuttgart.de/ticker/rus-cert.rdf'; //For Windows
$CACHE_REFRESH_TIME = 20; //Cache timeout in minutes
$MAX_NEWS = 9; //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://cert.uni-stuttgart.de/ticker/rus-cert.rdf'));
@unlink($CACHE_FILE);
$handle = @fopen($CACHE_FILE, 'x+');
@fwrite($handle, $fcontents);
@fclose($handle);
}
$fcontents = join ('', @file ($CACHE_FILE));
} else {
$fcontents = join ('', @file ('http://cert.uni-stuttgart.de/ticker/rus-cert.rdf'));
}
$fcontents = utf8_decode ($fcontents);
$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]);
$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;
?>