note 29397 added to function.fstat
| From: | dom at dodgydom dot com | Date: | Wed, 12 Feb 2003 14:33:39 +0000 |
| Subject: | note 29397 added to function.fstat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43823@lists.php.net to get a copy of this message | ||
Example for getting remote file stats.
Best way i found was to open the url into $data and make a temporary file with the contents of $data
then get the fstats on the temporary file :).
$url="http://www.testurl.com";
$fp=fopen($url,"r");
$data=fread($fp,"1000000");
fclose($fp);
$test_file="./temp_file.txt";
$fp_test=fopen($test_file,"w+");
$fp_write=fputs($fp_test,$data);
fclose($fp_test);
$stat_file='./temp_file.txt';
$test_fp=fopen($stat_file,"r");
$stats=fstat($test_fp);
fclose($test_fp);
print_r($stats);
Seems to work fine for me, If there is a quicker way i havn't found it yet.
--
http://www.php.net/manual/en/function.fstat.php
http://master.php.net/manage/user-notes.php?action=edit+29397
http://master.php.net/manage/user-notes.php?action=delete+29397
http://master.php.net/manage/user-notes.php?action=reject+29397