Current Location: Home> Function Categories> ftp_exec

ftp_exec

Execute a program/command on FTP.
Name:ftp_exec
Category:Uncategorized
Programming Language:php
One-line Description:Execute a program/command on FTP.

Definition and usage

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);
?>

grammar

 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.

illustrate

This function sends a SITE EXEC command request to the FTP server.

Similar Functions
Popular Articles