function getFileSize($url)
{
$cURLsession = curl_init();
curl_setopt($cURLsession, CURLOPT_URL, $url);
curl_setopt($cURLsession, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($cURLsession, CURLOPT_HEADER, TRUE);
curl_setopt($cURLsession, CURLOPT_NOBODY, TRUE);
$data = curl_exec($cURLsession);
if(($curlResult = curl_exec($cURLsession)) === false)
{
echo "Ошибка при получении данных: ".curl_error($cURLsession).". С ".$url;
}
$responseType = curl_getinfo($cURLsession, CURLINFO_CONTENT_TYPE);
$fileSize = curl_getinfo($cURLsession, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($cURLsession);
return $fileSize;
}
Если больше разрешенного,- не грузим