// 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 = 10800) {
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 = "X93C9839A7EA5AF850DC98E97CD22E8C0.gif", 10800)) {
// 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/X93C9839A7EA5AF850DC98E97CD22E8C0.gif");
// Write the contents back to the file
file_put_contents($filename, $current);
error_log("neues widget gespeichert!");
}else{
error_log("altes widget geladen!");
}
?>

 | | | |
|