Class ftp_connection
Class ftp_connection
Simple FTP protocol implementation.
Package: SMF
Copyright:
2020 Simple Machines and individual contributors
License:
BSD
Author:
Simple Machines https://www.simplemachines.org
See:
https://tools.ietf.org/html/rfc959
Located at Sources/Class-Package.php
Methods summary
public
|
#
__construct( string $ftp_server, integer $ftp_port = 21, string $ftp_user = 'anonymous', string $ftp_pass = 'ftpclient@simplemachines.org' )
Create a new FTP connection...
Create a new FTP connection...
Parameters
- $ftp_server
- The server to connect to
- $ftp_port
- The port to connect to
- $ftp_user
- The username
- $ftp_pass
- The password
|
public
|
#
connect( string $ftp_server, integer $ftp_port = 21, string $ftp_user = 'anonymous', string $ftp_pass = 'ftpclient@simplemachines.org' )
Connects to a server
Parameters
- $ftp_server
- The address of the server
- $ftp_port
- The port
- $ftp_user
- The username
- $ftp_pass
- The password
|
public
boolean
|
#
chdir( string $ftp_path )
Changes to a directory (chdir) via the ftp connection
Changes to a directory (chdir) via the ftp connection
Parameters
- $ftp_path
- The path to the directory we want to change to
Returns
boolean Whether or not the operation was successful
|
public
boolean
|
#
chmod( string $ftp_file, integer|string $chmod )
Changes a files atrributes (chmod)
Changes a files atrributes (chmod)
Parameters
- $ftp_file
- The file to CHMOD
- $chmod
- The value for the CHMOD operation
Returns
boolean Whether or not the operation was successful
|
public
boolean
|
#
unlink( string $ftp_file )
Deletes a file
Parameters
- $ftp_file
- The file to delete
Returns
boolean Whether or not the operation was successful
|
public
boolean
|
#
check_response( string $desired )
Reads the response to the command from the server
Reads the response to the command from the server
Parameters
- $desired
- The desired response
Returns
boolean Whether or not we got the desired response
|
public
boolean
|
#
passive( )
Used to create a passive connection
Used to create a passive connection
Returns
boolean Whether the passive connection was created successfully
|
public
boolean
|
#
create_file( string $ftp_file )
Creates a new file on the server
Creates a new file on the server
Parameters
- $ftp_file
- The file to create
Returns
boolean Whether or not the file was created successfully
|
public
string|boolean
|
#
list_dir( string $ftp_path = '', boolean $search = false )
Generates a directory listing for the current directory
Generates a directory listing for the current directory
Parameters
- $ftp_path
- The path to the directory
- $search
- Whether or not to get a recursive directory listing
Returns
string|boolean The results of the command or false if unsuccessful
|
public
string|boolean
|
#
locate( string $file, string $listing = null )
Determines the current directory we are in
Determines the current directory we are in
Parameters
- $file
- The name of a file
- $listing
- A directory listing or null to generate one
Returns
string|boolean The name of the file or false if it wasn't found
|
public
boolean
|
#
create_dir( string $ftp_dir )
Creates a new directory on the server
Creates a new directory on the server
Parameters
- $ftp_dir
- The name of the directory to create
Returns
boolean Whether or not the operation was successful
|
public
array
|
#
detect_path( string $filesystem_path, string $lookup_file = null )
Detects the current path
Parameters
- $filesystem_path
- The full path from the filesystem
- $lookup_file
- The name of a file in the specified path
Returns
array An array of detected info - username, path from FTP root and whether or not the current path was found
|
public
boolean
|
#
close( )
Close the ftp connection
Returns
boolean Always returns true
|
Properties summary
public
string
|
$connection
Holds the connection response
Holds the connection response
|
|
public
string
|
$error
|
|
public
string
|
$last_message
Holds the last message from the server
Holds the last message from the server
|
|
public
boolean
|
$pasv
Whether or not this is a passive connection
Whether or not this is a passive connection
|
|