Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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_site() function in PHP
The ftp_site() function sends an FTP SITE command to the FTP server.
Syntax
ftp_site(conn,command);
Parameters
conn − The FTP connection
command − The SITE command. These commands vary from server to server and used in handling OS specific features such as file permissions and group membership.
Return
The ftp_site() function returns TRUE on success or FALSE on failure.
Example
The following is an example −
<?php
$ftp_server = "192.168.0.4";
$ftp_user = "username";
$ftp_pass = "gfhgfj236k";
$conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($con, $ftp_user, $ftp_pass);
if (ftp_site($conn, "chmod 777 myfile.txt")) {
echo "Command executed!";
} else {
echo "Command failed execution!";
}
// close
ftp_close($conn);
?>Advertisements