"
function remote_filesize($url) { ob_start(); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); $ok = curl_exec($ch); curl_close($ch); $head = ob_get_contents(); ob_end_clean(); $regex = '/Content-Length:\s([0-9].+?)\s/'; $count = preg_match($regex, $head, $matches); return isset($matches[1]) ? $matches[1] : "0"; } function add_path_redir($file,$domen,$path_redirect) { $file = str_replace($domen.'/'.$path_redirect,$domen,$file); $file = str_replace($domen,$domen.'/'.$path_redirect,$file); return $file; } function getFileSize($file){ $array_size_files = "/home/falcowar/public_html/loganalyzer/array_size_files.php"; //поскольку редирект, в урл добавляем нелдостающии каталог $file = add_path_redir($file,'falcogames.com','distributives'); $file = add_path_redir($file,'falcoware.com','distributives'); @include $array_size_files; if (!isset($array_sizes[$file])) {//если нет этого элемента в массиве, то запрос размера и сохраняем $size = remote_filesize($file); $array_sizes[$file] = $size; @unlink ($array_size_files); @file_put_contents($array_size_files, ""); } return round($array_sizes[$file]/1024/1024,2); } ?>