Re: fopen, fread
| From: | CC Zona | Date: | Sat, 22 Sep 2001 04:32:39 +0000 |
| Subject: | Re: fopen, fread | ||
| References: | 1 | Groups: | php.dev php.general |
| Request: | Send a blank email to php-dev+get-66321@lists.php.net to get a copy of this message | ||
In article <20010921174303.5627.qmail@pb1.pair.com>,
dries@plessers.com (Dries Plessers) wrote:
> Can anybody tell me what is wrong. $file contains nothing ?????
> $fileName="http://www.proxis.com";
> $fp=fopen($fileName, "r");
> $file=fread($fp, filesize($fileName));
> fclose($fp);
> print("$file");
Not a good idea to just assume that every fopen will be successful (and
therefore go ahead with the read) or that every fread will be successful
(and therefore go ahead with the print). Throw some error checking in
there, and PHP will likely tell you where the code is failing and why.
--
CC