I thought filesize required the file name, and not the fileptr???

Warren Vail


-----Original Message-----
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 15, 2004 10:17 AM
To: php php
Subject: Re: [PHP] fopen problem, 5 line script


* Thus wrote Mag:
> Hi,
> Can someone tell me what I am doing wrong here please?
> 
> <?php
> $fileptr =
> fopen("http://www.google.com/index.html","r";);
> 
> $contents = fread($fileptr, filesize($fileptr));
>...
> 
> This is the error I get:
> Warning: filesize(): Stat failed for Resource id #1
> (errno=2 - No such file or directory) in 
> /home/quickxxx/public_html/tpg/ check- remote.php on line 4
> 
> Warning: fread(): Length parameter must be greater
> than 0. in /
> home/quickxxx/public_html/tpg/check-remote.php on line

filesize() relies on the fact that the file you opened has support for
stat(). the http wrapper does not have such a thing.

see:
  http://php.net/filesize
  http://php.net/wrappers.http


Curt
-- 
The above comments may offend you. flame at will.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to