phpbar.de logo

Mailinglisten-Archive

[php] Systembefehl FTP aufrufen ???

[php] Systembefehl FTP aufrufen ???

Kristian =?iso-8859-1?Q?K=F6hntopp?= kk_(at)_netuse.de
Wed, 17 Nov 1999 12:30:21 +0100


Stefan Pfister wrote:
> kann mir jemand verraten, wie ich mein PHP3 Skript
> dazu bringe das FTP Kommando aufzurufen ? Also das
> was in der Shell so aussieht:
> 
> # ftp xxx.xxx.xxx.xxx
> 
> Das einloggen und der download soll dann mittels
> eines .netrc files eigentlich von alleine laufen,
> bloss anschmeissen  muss ichs halt.

Warum auf diese Weise?


From: Kristian Köhntopp <kk_(at)_netuse.de>                      08:15
Subject:  Re: [PHP-DEV] Passing an Object


Somebody wrote:
> Well, since you seem to be the pro on this, what would be a 
> secure way to use ftp through php?

Sorry, I am missing the context here. How is this question related to
the previous dialogue?

Anyway, there is a dedicated, but as of now undocumented set of ftp
functions in the current CVS version of PHP, which is available
when you recompile with "--with-ftp". That might be exactly the
functionality you are looking for.

Documentation returned from the source:

function_entry php3_ftp_functions[] = {
        PHP_FE(ftp_connect,                     NULL)
        PHP_FE(ftp_login,                       NULL)
        PHP_FE(ftp_pwd,                         NULL)
        PHP_FE(ftp_cdup,                        NULL)
        PHP_FE(ftp_chdir,                       NULL)
        PHP_FE(ftp_mkdir,                       NULL)
        PHP_FE(ftp_rmdir,                       NULL)
        PHP_FE(ftp_nlist,                       NULL)
        PHP_FE(ftp_rawlist,                     NULL)
        PHP_FE(ftp_systype,                     NULL)
        PHP_FE(ftp_pasv,                        NULL)
        PHP_FE(ftp_get,                         NULL)
        PHP_FE(ftp_fget,                        NULL)
        PHP_FE(ftp_put,                         NULL)
        PHP_FE(ftp_fput,                        NULL)
        PHP_FE(ftp_size,                        NULL)
        PHP_FE(ftp_mdtm,                        NULL)
        PHP_FE(ftp_rename,                      NULL)
        PHP_FE(ftp_delete,                      NULL)
        PHP_FE(ftp_quit,                        NULL)
        {NULL, NULL, NULL}
};

/* {{{ proto int ftp_connect(string host [, int port])
   Open a FTP stream */

/* {{{ proto int ftp_login(int stream, string username, string password)
   Logs into the FTP server. */

/* {{{ proto string ftp_pwd(int stream)
   Returns the present working directory. */

/* {{{ proto int ftp_cdup(int stream)
   Changes to the parent directory */

/* {{{ proto int ftp_chdir(int stream, string directory)
   Changes directories */

/* {{{ proto string ftp_mkdir(int stream, string directory)
   Creates a directory */

/* {{{ proto int ftp_rmdir(int stream, string directory)
   Removes a directory */

/* {{{ proto array ftp_nlist(int stream, string directory)
   Returns an array of filenames in the given directory */

/* {{{ proto array ftp_rawlist(int stream, string directory)
   Returns a detailed listing of a directory as an array of output lines */

/* {{{ proto string ftp_systype(int stream)
   Returns the system type identifier */

/* {{{ proto int ftp_fget(int stream, int fp, string remote_file, int mode)
   Retrieves a file from the FTP server and writes it to an open file. */

/* {{{ proto int ftp_pasv(int stream, int pasv)
   Turns passive mode on or off. */

/* {{{ proto int ftp_get(int stream, string local_file, string remote_file,
int mode)
   Retrieves a file from the FTP server and writes it to a local file. */

/* {{{ proto int ftp_fput(int stream, string local_file, string remote_file,
int  mode)
   Stores a file from an open file to the FTP server. */

/* {{{ proto int ftp_put(int stream, string remote_file, string local_file,
int mode)
   Stores a file on the FTP server */

/* {{{ proto int ftp_size(int stream, string path)
   Returns the size of the file, or -1 on error. */

/* {{{ proto int ftp_mdtm(int stream, string path)
   Returns the last modification time of the file, or -1 on error */

/* {{{ proto int ftp_rename(int stream, string src, string dest)
   Renames the given file to a new path */

/* {{{ proto int ftp_delete(int stream, string path)
   Deletes a file */

/* {{{ proto int ftp_quit(int stream)
   Closes the FTP stream */

/* {{{ proto int ftp_delete(int stream, string path)
   Deletes a file */

/* {{{ proto int ftp_quit(int stream)
   Closes the FTP stream */
-- 
Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.netuse.de/ (We have moved! Update your bookmarks!)


php::bar PHP Wiki   -   Listenarchive