FTP_EXEC(3) 1 FTP_EXEC(3)ftp_exec - Requests execution of a command on the FTP serverSYNOPSIS
bool ftp_exec (resource $ftp_stream, string $command)
DESCRIPTION
Sends a SITE EXEC $command request to the FTP server.
PARAMETERS
o $ftp_stream
- The link identifier of the FTP connection.
o $command
- The command to execute.
RETURN VALUES
Returns TRUE if the command was successful (server sent response code: 200); otherwise returns FALSE.
EXAMPLES
Example #1
ftp_exec(3) example
<?php
// variable initialization
$command = 'ls -al >files.txt';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// execute command
if (ftp_exec($conn_id, $command)) {
echo "$command executed successfully
";
} else {
echo "could not execute $command
";
}
// close the connection
ftp_close($conn_id);
?>
SEE ALSO ftp_raw(3).
PHP Documentation Group FTP_EXEC(3)
Check Out this Related Man Page
FTP_FPUT(3) 1 FTP_FPUT(3)ftp_fput - Uploads from an open file to the FTP serverSYNOPSIS
bool ftp_fput (resource $ftp_stream, string $remote_file, resource $handle, int $mode, [int $startpos])
DESCRIPTION ftp_fput(3) uploads the data from a file pointer to a remote file on the FTP server.
PARAMETERS
o $ftp_stream
- The link identifier of the FTP connection.
o $remote_file
- The remote file path.
o $handle
- An open file pointer on the local file. Reading stops at end of file.
o $mode
- The transfer mode. Must be either FTP_ASCII or FTP_BINARY.
o $startpos
-The position in the remote file to start uploading to.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
ftp_fput(3) example
<?php
// open some file for reading
$file = 'somefile.txt';
$fp = fopen($file, 'r');
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to upload $file
if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
echo "Successfully uploaded $file
";
} else {
echo "There was a problem while uploading $file
";
}
// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);
?>
SEE ALSO ftp_put(3), ftp_nb_fput(3), ftp_nb_put(3).
PHP Documentation Group FTP_FPUT(3)
Hi,
I am trying to write and automate a ftp job that connects to a IBM mainframe and pulls the same files everyday.
To do this I assumen I create a .netrc file in my solaris home directory, then I write a shell script. How do I envoke ftp from a ksh script and pass it the info in .netrc?
I... (11 Replies)
Hi,
I have a folder ABC.
I have sftp executing from this folder successfully to other servers using keys which avoids passowrd prompt.
The permissions for the folder are only for user.ie drwx------
But i need another id to access my folder and execute the scripts.
So i changed the access... (2 Replies)
I just been audited and one the recommendations is to hide the SSH version or give fake information.
I went to openssh.com they don't seem to have any info on how to fix this :confused:
Anybody knows how the heck can I hide the SSH version? The part which says
# telnet localhost 22... (19 Replies)
Hello guys,
i'm searching for a solution how to download all files from root-directory of an ftp-server through an ftp proxy
getting through the ftp proxy and download one file with get ist no problem, but mget * does nothing!
ftp -n -i -v <<EOF
open proxyHost proxyPort
user... (19 Replies)
I am attempting to utilize an expect script (that is called from a parent bash script) to perform a file transfer over sftp.
The script works except I cannot catch timeouts. I need to be able to tell in the parent bash script when the expect script has timed out, or completed successfully.
It... (3 Replies)
Hi,
My requirement is that I should execute SFTP from /users/XYZ dir and get the file on to /users/XYZ/TEST folder with out the sys error.
I'm facing the following strange issue with SFTP execution. I need to copy a file 'abc.txt' from Remote m/c(MyServer) to local machine(Server1). I've... (3 Replies)
hi,
is there a way i can execute a batch file containing ftp commands like we execute sftp batch file.
sftp -b batchfile user@server > output
how to create a batch file for ftp executing command and how to run the batch file from a shell script? (2 Replies)
Hi all,
I have a problem with ftp execution within unix environment.
I'd like to get files on remote and delete them later, but here is too crowd so I can accidentally delete some files. Can I delete only the files I can get to the local folder? I can ask this question with a different... (14 Replies)
Hello dear Users,
I am for the first time in this forum. I come from Germany. Please excuse my bad englisch. My OS is SCO open Server Release 5.
I have a problem whith FTP and the command "site exec"
if I use the command "ftp> site chmod 777 /tmp/startkpf.sc
200 CHMOD command successful. ... (8 Replies)
Hello,
I am trying to run a shell script that tests the connectivity to all the sftp servers and email if any one of them is down. There are aliases for all the servers with sftp command prefix in a '.alias' file. But when I use the alias name to run it as a command in my shell script to test... (3 Replies)