ftp_exec
Execute a program/command on FTP.
ftp_exec()
function requests that a program or command be executed on the FTP server.
If successful (the server sends the response code 200), it returns true, otherwise it returns false.
<?php $command = "ls-al > test.txt"; $conn = ftp_connect("ftp.testftp.com") or die("Could not connect"); ftp_login($conn,"admin","ert456"); if (ftp_exec($conn,$command)) { echo "Command executed successfully"; } else { echo "Execution of command failed"; } ftp_close($conn); ?>
ftp_exec ( ftp_connection , command )
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to be used (the identifier of the FTP connection). |
Command | Required. Specifies a naming request sent to the server. |
This function sends a SITE EXEC command request to the FTP server.