![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_exec() function in PHP
The ftp_exec() function is used to execute a command on the FTP server.
Syntax
ftp_exec(con, command)
Parameters
con − The FTP connection
command − The command to execute.
Return
The ftp_exec() function returns TRUE if the command was executed successfully, else FALSE.
Example
The following is an example that executes a command on the FTP server −
<?php $ftp_server="192.168.0.4"; $ftp_user="amit"; $ftp_pass="tywg61gh"; $con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); // list all the files of the remote directory $command = 'ls'; // execute command if (ftp_exec($con,$command)) { echo "Executed successfully!"; } else { echo "Execution failed!"; } ftp_close($con); ?>
Advertisements