Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ftp_exec(3) [php man page]

FTP_EXEC(3)								 1							       FTP_EXEC(3)

ftp_exec - Requests execution of a command on the FTP server

SYNOPSIS
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 server

SYNOPSIS
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)
Man Page

11 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

automate an ftp job

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)
Discussion started by: flowrats
11 Replies

2. Shell Programming and Scripting

sftp problem

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)
Discussion started by: borncrazy
2 Replies

3. Solaris

How to hide SSH version

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)
Discussion started by: sparcguy
19 Replies

4. Shell Programming and Scripting

Ftp

wat it exactly mean ? ftp -dn 2>&1 <<EOF (3 Replies)
Discussion started by: lakila
3 Replies

5. Shell Programming and Scripting

shell script - ftp downloading serveral files without mget

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)
Discussion started by: macProgger23
19 Replies

6. Shell Programming and Scripting

Expect Script for SFTP Upload

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)
Discussion started by: thaller
3 Replies

7. Shell Programming and Scripting

SFTP GET Local folder issue

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)
Discussion started by: skpvalvekar
3 Replies

8. Shell Programming and Scripting

How to execute a batch file containing ftp commands??

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)
Discussion started by: Little
2 Replies

9. UNIX for Dummies Questions & Answers

Execution of local commands for remote site.

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)
Discussion started by: attillam
14 Replies

10. SCO

FTP problem with site exec command

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)
Discussion started by: fla5do
8 Replies

11. Shell Programming and Scripting

Initialize aliases during shell script execution

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)
Discussion started by: Dippu
3 Replies