Ben "derleyici-latest.zip" (googlecode.com) aslında indirmeden cURL kullanarak, burada benim PHP kodu uzaktan dosya bir dosya boyutunu almak için çalışıyorum:
$url = 'http://closure-compiler.googlecode.com/files/compiler-latest.zip';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // optional
curl_setopt($ch, CURLOPT_MAXREDIRS, 10); // optional
curl_setopt($ch, CURLOPT_TIMEOUT, 60); // optional
$result = curl_exec($ch);
$filesize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($ch);
print 'Filesize: ' . $filesize . '<br><br>';
print_r($result);
But, I get "HTTP/1.1 404 Not Found" status with a file size (1379 bytes) of this error 404 document. So, if I set (CURLOPT_NOBODY, 0) it downloads file and returns its correct file size (currently 3820320 bytes). My question is how to get a correct file size of "compiler-latest.zip" file without downloading it?
ÖNEMLİ: googlecode.com dışında başka bir url ile beklendiği gibi bu kod çalışır.