The ftp_exec() function requests the execution of a program or command on the FTP server.
If successful, the function returns TRUE. If it fails, returns FALSE.
ftp_exec(ftp_connection,command)
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to use. |
command | Required. Specifies the command request sent to the FTP server. |
Note: Unlike the ftp_raw() function, ftp_exec() cannot send commands until you are logged in to the FTP server.
<?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);?>