// file_put_contents not available for PHP4
if (!function_exists('file_put_contents')) {
function file_put_contents($file, $contents = '', $method = 'a+') {
$file_handle = fopen($file, $method);
fwrite($file_handle, $contents);
fclose($file_handle);
return true;
}
}
function cachecheck($filename_cache, $timeout = 43200) {
if (file_exists($filename_cache)) {
$timestamp = filemtime($filename_cache);
// Seconds
if (mktime() - $timestamp < $timeout) {
return true;
} else
return false;
} else
return false;
}
if (!cachecheck($filename = "X9CBF95166F00EBB7BAEEBCEE102DE1A0.gif", 43200)) {
// Load fresh widget from trustedshops Website
// and write in local file
// Open the file to get existing content
$current =
file_get_contents("https://www.trustedshops.com/bewertung/widget/widgets/X9CBF95166F00EBB7BAEEBCEE102DE1A0.gif");
// Write the contents back to the file
file_put_contents($filename, $current);
error_log("neues widget gespeichert!");
}else{
error_log("altes widget geladen!");
}
?>
|