Re: I need a useful sample code for opening from ftp servers using fopen() or file() commands

From: Date: Wed, 04 Sep 2002 01:14:18 +0000
Subject: Re: I need a useful sample code for opening from ftp servers using fopen() or file() commands
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115130@lists.php.net to get a copy of this message
Note that you can use also: $content = implode("",file($filename)"); but I dont know if file() works with ftp. You should use my first tip anyway. -- Nicos - CHAILLAN Nicolas nicos@php.net www.WorldAKT.com - Hébergement de sites Internet "Javier Campo Martinez" <jcampom@electricaribe.com> a écrit dans le message de news: 012e01c253ab$1669a310$5989f00a@costacaribe.com... 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

« previous php.general (#115130) next »