Autor | Zpráva | ||
---|---|---|---|
czpete Profil |
#1 · Zasláno: 4. 8. 2008, 11:31:53
Všechny scripty, které jsem našel chtějí dir, ale potřeboval bych něco pro jinou url. (mám php4)
Díky |
||
BetaCam Profil |
#2 · Zasláno: 4. 8. 2008, 12:02:18
czpete
Script by Mr. Google : <?php function getRemoteFileSize($url){ $parsed = parse_url($url); $host = $parsed["host"]; $fp = @fsockopen($host, 80, $errno, $errstr, 20); if(!$fp)return false; else { @fputs($fp, "HEAD $url HTTP/1.1\r\n"); @fputs($fp, "HOST: $host\r\n"); @fputs($fp, "Connection: close\r\n\r\n"); $headers = ""; while(!@feof($fp))$headers .= @fgets ($fp, 128); } @fclose ($fp); $return = false; $arr_headers = explode("\n", $headers); foreach($arr_headers as $header) { $s = "Content-Length: "; if(substr(strtolower ($header), 0, strlen($s)) == strtolower($s)) { $return = trim(substr($header, strlen($s))); break; } } if($return){ $size = round($return / 1024, 2); $sz = "KB"; // Size In KB if ($size > 1024) { $size = round($size / 1024, 2); $sz = "MB"; // Size in MB } $return = "$size $sz"; } return $return; } echo getRemoteFileSize('http://example.com/aaa.jpg'); ?> |
||
czpete Profil |
#3 · Zasláno: 4. 8. 2008, 12:36:17
Moc děkuji
|
||
Časová prodleva: 16 let
|
0