<?php
$useragent = $_SERVER["HTTP_USER_AGENT"];
$ipaddress = $_SERVER["HTTP_X_REAL_IP"];
$hostname = gethostbyaddr($ipaddress);
if ((strpos($hostname, 'cable-xdsl.tld') !== false) and (strpos($useragent, 'Wget') !== false))
{
$timestamp = date("Y-m-d_H-i-s");
$url = "https://webcam.tld/full.jpg";
$img = "./webcam/img_".$timestamp.".jpg";
file_put_contents($img, file_get_contents($url));
print "OK...action performed :-)";
}
else {
echo 'Error...you are not permitted to perform this action :-(';
}
?>