diff options
author | Sara Golemon <pollita@php.net> | 2003-01-31 04:54:57 +0000 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2003-01-31 04:54:57 +0000 |
commit | 81797baed4386e726b79aaa99f7fb4887d8d9348 (patch) | |
tree | 471206b0d91acf8230ff87dafb5bbeaf4b39ee71 /ext/ftp/php_ftp.c | |
parent | ff605d071f2c9b98c0c307371c0f822aded002e6 (diff) | |
download | php-git-81797baed4386e726b79aaa99f7fb4887d8d9348.tar.gz |
Add ftp_raw() to send raw command strings to an FTP server.
Diffstat (limited to 'ext/ftp/php_ftp.c')
-rw-r--r-- | ext/ftp/php_ftp.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index d43211ad39..2cc8d198ab 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -56,6 +56,7 @@ function_entry php_ftp_functions[] = { PHP_FE(ftp_cdup, NULL) PHP_FE(ftp_chdir, NULL) PHP_FE(ftp_exec, NULL) + PHP_FE(ftp_raw, NULL) PHP_FE(ftp_mkdir, NULL) PHP_FE(ftp_rmdir, NULL) PHP_FE(ftp_chmod, NULL) @@ -331,6 +332,26 @@ PHP_FUNCTION(ftp_exec) } /* }}} */ +/* {{{ proto array ftp_raw(resource stream, string command) + Sends a literal command to the FTP server */ +PHP_FUNCTION(ftp_raw) +{ + zval *z_ftp; + ftpbuf_t *ftp; + char *cmd; + int cmd_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); + + /* execute arbitrary ftp command */ + ftp_raw(ftp, cmd, return_value); +} +/* }}} */ + /* {{{ proto string ftp_mkdir(resource stream, string directory) Creates a directory and returns the absolute path for the new directory or false on error */ PHP_FUNCTION(ftp_mkdir) |