By this line: readfile($file_name);
What Am I missing, beyond strong programmer mind set.
Code: Select all
$merch_map = "http://spot_map";
$dir = "/opt/tmp/media/current";
class merch_imgs {
public function __construct() {
$this->merch_imgs1();
}
public function __call($method, $_) {
$count = str_replace('merch_imgs', '', $method);
echo "$count ";
$this->{"merch_imgs" . ++$count}();
}
}
class thousand_printer extends merch_imgs {
public function merch_imgs1000() {}
}
//03-2012. Location of merchant, if no image use place holder
$thumbnails = implode(',', range(1, 10000));
$ext = ".png";
for($thumbnails = 0; $thumbnails < 10000; $thumbnails++) {
$url = $merch_map.'/'.$thumbnails.''.$ext;
echo $url . '<br>';
//echo '<img src='.$url.' border=0/>';
downloader($url, $dir);
}
function downloader($url){
$file_name = basename($url);
$generated_files = geturl($url, $url);
//file_put_contents($file_name);
file_put_contents($url, $url = var_export($file_name,true));
$size=strlen($generated_files);
if($size==0){exit(0);("<b>Error:</b>not found!");}
//header('Content-type: application/force-download');
//header('Content-Disposition: attachment; filename=' . $file_name);
//header('Content-Transfer-Encoding: binary');
//header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
//header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
//header('Pragma: public');
//header('Content-Length: ' . $size);
readfile($file_name);
unlink($file_name);
}
function geturl($url, $referer) {
$headers[] = 'Accept: image/png';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$user_agent = 'ONLY_MY_HOST';
//$useragent = $url;
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $user_agent);
curl_setopt($process, CURLOPT_REFERER, $referer);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
$return = curl_exec($process);
curl_close($process);
return $return;
}
//downloader($dir, $url);
//Merchant Images
if($url && $user_agent){
file_get_contents($url);
die();
}