note 29397 deleted from function.fstat by nlopess
| From: | nlopess@php.net | Date: | Sun, 29 Jan 2006 22:15:18 +0000 |
| Subject: | note 29397 deleted from function.fstat by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102695@lists.php.net to get a copy of this message | ||
Note Submitter: dom at dodgydom dot com
----
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.