fgets()
| From: | Khalid El-Kary | Date: | Mon, 04 Nov 2002 07:46:13 +0000 |
| Subject: | fgets() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122632@lists.php.net to get a copy of this message | ||
hi,
i want to open a remote file using fopen() i tried both of these ways
$filename="http://www.domain.com/filename.txt";
$file=fopen($filename,"r");
$filecontents=fread($file,filesize($filename));
this one didn't work because it's apparent that the file isn't in the local file system so filesize($filename) won't work ...
the second way was this:
$filename="http://www.domain.com/filename.txt";
$file=fopen($filename,"r");
$filecontents="";
while (!feof($file))
{
$filecontents.=fgets($file);
}
this one worked well with PHP4.2.3 but with versions under PHP 4.2.0 it didn't work
So what else can i try to just get the whole contents of the file into a string?
thanx
khalid
_________________________________________________________________
Internet access plans that fit your lifestyle -- join MSN. http://resourcecenter.msn.com/access/plans/default.asp