note 27803 added to function.fopen
| From: | digitalife at 163 dot com | Date: | Thu, 19 Dec 2002 09:14:05 +0000 |
| Subject: | note 27803 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41101@lists.php.net to get a copy of this message | ||
i found a bug in fopen() the FTP://URL file
this is my test program:
<?php
print("<H1>FTP</H>\n");
print("<HR>\n");
//open a file using ftp protocol
if (! ($myFile = @fopen("ftp://usrername:password@10.10.6.2/AUTOPT.PRG","r")))
{
print("file could not be opened");
exit;
}
/* Note: we know ,in win32, the ftp://username:password@url/filename can be
recognised correct, with function fopen(),can return a ftp file's handle
*/
while (! feof($myFile))
{
// read a line from the file
$myLine = fgetss($myFile,255);
print("$myLine<br>\n");
}
// close the file
@fclose($myFile);
/* Note: but in while loop sentence,the statement did not run,why,becoz the $myFile already pointed
to the end of file when it's open.
*/
?>
--
http://www.php.net/manual/en/function.fopen.php
http://master.php.net/manage/user-notes.php?action=edit+27803
http://master.php.net/manage/user-notes.php?action=delete+27803
http://master.php.net/manage/user-notes.php?action=reject+27803