note 48346 deleted from function.filesize by nlopess
| From: | nlopess@php.net | Date: | Mon, 20 Dec 2004 11:55:42 +0000 |
| Subject: | note 48346 deleted from function.filesize by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82079@lists.php.net to get a copy of this message | ||
Note Submitter: nobody6 at telenet dot be
----
For getting the file size of a extern file:
<?php
function get_size($page){
$file=str_replace('\"','"',file_get_contents($page));
$handle=fopen('tmp.dat', "w");
fwrite($handle, $file);
fclose($handle);
$size=filesize('tmp.dat');
unlink('tmp.day');
return $size;
}
$size=get_size('http://www.google.com');
?>
Its open the file, writes his source into a new file on the server. and gets the filesize of that
file and delete it.