I need a useful sample code for opening from ftp servers using fopen() or file() commands
| From: | Javier Campo Martinez | Date: | Wed, 04 Sep 2002 00:36:18 +0000 |
| Subject: | I need a useful sample code for opening from ftp servers using fopen() or file() commands | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115128@lists.php.net to get a copy of this message | ||
Hi,
I will appreciate if you have some sample code about opening a file from a UNIX server.
This is the code I wrote for this issue:
<?php // test program
$conn_id=0;
$fich = fopen("ftp://usuario:clave@servidor/afiedt.buf","r");
while ($fich[$i]) {
echo $fich[$i];
echo "<br>";
$i++;
}
?>
This is the message error/warning:
Warning: File not found in d:\apache\htdocs\lee_fichero2.php3 on line 3
Warning: file("ftp://...@servidor/afiedt.buf") - No such file
or directory in d:\apache\htdocs\lee_fichero2.php3 on line 3
In the other hand, my php version is 4.0
In the help of the command fopen(), it says:
If filename begins with "ftp://" (not case sensitive), an ftp
connection to the specified server is opened and a pointer to the requested file is returned. If the
server does not support passive mode ftp, this will fail. You can open files for either reading or
writing via ftp (but not both simultaneously).
phpinfo() returns me the following ftp topic:
FTP support enabled
I just don't know what more can I do ...
Thanx in advance
Javier