note 27803 rejected from function.fopen by jmcastagnetto

From: Date: Thu, 19 Dec 2002 09:24:20 +0000
Subject: note 27803 rejected from function.fopen by jmcastagnetto
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41107@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. */ ?>

« previous php.notes (#41107) next »