- time: documentation ( source)
- copy: documentation ( source)
- filemtime: documentation ( source)
- file_exists: documentation ( source)
<?php
#Settings
$interval = 30;
$filename = 'picture.jpg';
$url = "http://www.goudenspike.nl/webcam/picture.jpg";
$fetchurl = "http://77.172.6.176:50015/picture.jpg";
#get file time
if (file_exists($filename)) {
$filetime = filemtime($filename);
} else {
copy($fetchurl,$filename);
$filetime = filemtime($filename);
}
$time = time();
$diff = $time - $filetime;
if($diff > $interval){
copy($fetchurl,$filename);
}
#header("Location: $url");
echo "<meta http-equiv=refresh content=30><IMG SRC=$url WIDTH=576 HEIGHT=432>"; exit; ?>