}
/* }}} */
+/* {{{ ftp_raw
+ */
+void
+ftp_raw(ftpbuf_t *ftp, const char *cmd, zval *return_value)
+{
+ if (ftp == NULL || cmd == NULL) {
+ RETURN_NULL();
+ }
+ if (!ftp_putcmd(ftp, cmd, NULL)) {
+ RETURN_NULL();
+ }
+ array_init(return_value);
+ while (ftp_readline(ftp)) {
+ add_next_index_string(return_value, ftp->inbuf, 1);
+ if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
+ return;
+ }
+ }
+}
+/* }}} */
+
/* {{{ ftp_chdir
*/
int
/* exec a command [special features], return true on success, false on error */
int ftp_exec(ftpbuf_t *ftp, const char *cmd);
+/* send a raw ftp command, return response as a hashtable, NULL on error */
+void ftp_raw(ftpbuf_t *ftp, const char *cmd, zval *return_value);
+
/* changes directories, return true on success, false on error */
int ftp_chdir(ftpbuf_t *ftp, const char *dir);
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)
}
/* }}} */
+/* {{{ 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)
PHP_FUNCTION(ftp_cdup);
PHP_FUNCTION(ftp_chdir);
PHP_FUNCTION(ftp_exec);
+PHP_FUNCTION(ftp_raw);
PHP_FUNCTION(ftp_mkdir);
PHP_FUNCTION(ftp_rmdir);
PHP_FUNCTION(ftp_chmod);