Class JFTP

Description

FTP client class

Located in /connector/ftp.php (line 47)

JObject
   |
   --JFTP
Variable Summary
 array $_autoAscii
 socket $_conn
 socket $_dataconn
 string $_OS
 array $_pasv
 string $_response
 int $_type
Method Summary
 JFTP __construct (mixed $options)
 boolean chdir (string $path)
 boolean chmod (string $path, string $mode)
 boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
 boolean create (string $path)
 boolean delete (string $path)
 boolean get (string $local, string $remote)
 JFTP &getInstance ([string $host = '127.0.0.1'], [mixed $options = null])
 string listDir ([string $path = null], [string $type = 'all'], boolean $search)
 boolean login ([string $user = 'anonymous'], [string $pass = '[email protected]'])
 boolean mkdir (string $path)
 string nameList ([string $path = null])
 string pwd ()
 boolean quit ()
 boolean read (string $remote, string &$buffer)
 boolean reinit ()
 boolean rename (string $from, string $to)
 boolean restart (int $point)
 boolean setOptions (array $options)
 boolean store (string $local, [string $remote = null])
 string syst ()
 boolean write (string $remote, string $buffer, [int $mode = FTP_ASCII])
 boolean _mode (int $mode)
 boolean _passive ()
 boolean _putCmd (string $cmd, mixed $expectedResponse, mixed $expected)
 boolean _verifyResponse (mixed $expected)
Variables
array $_autoAscii = array ("asp", "bat", "c", "cpp", "csv", "h", "htm", "html", "shtml", "ini", "inc", "log", "php", "php3", "pl", "perl", "sh", "sql", "txt", "xhtml", "xml") (line 104)

Array to hold ascii format file extensions

  • access: private
  • final:
socket $_conn = null (line 55)

Server connection resource

  • var: resource
  • access: private
socket $_dataconn = null (line 63)

Data port connection resource

  • var: resource
  • access: private
array $_lineEndings = array ('UNIX' => "\n", 'MAC' => "\r", 'WIN' => "\r\n") (line 113)

Array to hold native line ending characters

  • access: private
  • final:
string $_OS = null (line 95)

Native OS Type

  • access: private
array $_pasv = null (line 71)

Passive connection information

  • access: private
string $_response = null (line 79)

Response Message

  • access: private
int $_type = null (line 87)

Transfer Type

  • access: private
Methods
Constructor __construct (line 115)
JFTP __construct (mixed $options)

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
chdir (line 319)

Method to change the current working directory on the FTP server

  • return: True if successful
  • access: public
boolean chdir (string $path)
  • string $path: Path to change into on the server
chmod (line 385)

Method to change mode for a path on the FTP server

  • return: True if successful
  • access: public
boolean chmod (string $path, string $mode)
  • string $path: Path to change mode on
  • string $mode: Octal value to change mode to
connect (line 189)

Method to connect to a FTP server

  • return: True if successful
  • access: public
boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
  • string $host: Host to connect to [Default: 127.0.0.1]
  • string $port: Port to connect on [Default: port 21]
create (line 462)

Method to create an empty file on the FTP server

  • return: True if successful
  • access: public
boolean create (string $path)
  • string $path: Path local file to store on the FTP server
delete (line 407)

Method to delete a path [file/folder] on the FTP server

  • return: True if successful
  • access: public
boolean delete (string $path)
  • string $path: Path to delete
get (line 558)

Method to get a file from the FTP server and save it to a local file

  • return: True if successful
  • access: public
boolean get (string $local, string $remote)
  • string $local: Path to local file to save remote file as
  • string $remote: Path to remote file to get on the FTP server

Redefinition of:
JObject::get()
getInstance (line 145)

Returns a reference to the global FTP connector object, only creating it if it doesn't already exist.

This method must be invoked as:

  $ftp = &JFTP::getInstance($host);

  • return: The FTP Client object.
  • since: 1.1
JFTP &getInstance ([string $host = '127.0.0.1'], [mixed $options = null])
  • string $host: Host to connect to
listDir (line 807)

Method to list the contents of a directory on the FTP server

  • return: Directory listing
  • access: public
string listDir ([string $path = null], [string $type = 'all'], boolean $search)
  • string $path: Path local file to store on the FTP server
  • string $type: Return type [raw|all|folders|files]
  • boolean $search: Recursively search subdirectories
login (line 225)

Method to login to a server once connected

  • return: True if successful
  • access: public
boolean login ([string $user = 'anonymous'], [string $pass = '[email protected]'])
  • string $user: Username to login to the server
  • string $pass: Password to login to the server
mkdir (line 426)

Method to create a directory on the FTP server

  • return: True if successful
  • access: public
boolean mkdir (string $path)
  • string $path: Directory to create
nameList (line 759)

Method to list the file/folder names of the contents of a directory on the FTP server

  • return: Directory listing
  • access: public
string nameList ([string $path = null])
  • string $path: Path local file to store on the FTP server
pwd (line 263)

Method to retrieve the current working directory on the FTP server

  • return: Current working directory
  • access: public
string pwd ()
quit (line 248)

Method to quit and close the connection

  • return: True if successful
  • access: public
boolean quit ()
read (line 495)

Method to read a file from the FTP server's contents into a buffer

  • return: True if successful
  • access: public
boolean read (string $remote, string &$buffer)
  • string $remote: Path to remote file to read on the FTP server
  • string $buffer: Buffer variable to read file contents into
reinit (line 341)

Method to reinitialize the server, ie. need to login again

NOTE: This command not available on all servers

  • return: True if successful
  • access: public
boolean reinit ()
rename (line 360)

Method to rename a file/folder on the FTP server

  • return: True if successful
  • access: public
boolean rename (string $from, string $to)
  • string $from: Path to change file/folder from
  • string $to: Path to change file/folder to
restart (line 444)

Method to restart data transfer at a given byte

  • return: True if successful
  • access: public
boolean restart (int $point)
  • int $point: Byte to restart transfer at
setOptions (line 173)

Set client options

  • return: True if successful
  • access: public
boolean setOptions (array $options)
  • array $options: Associative array of options to set
store (line 625)

Method to store a file to the FTP server

  • return: True if successful
  • access: public
boolean store (string $local, [string $remote = null])
  • string $local: Path to local file to store on the FTP server
  • string $remote: FTP path to file to create
syst (line 287)

Method to system string from the FTP server

  • return: System identifier string
  • access: public
string syst ()
write (line 712)

Method to write a string to the FTP server

  • return: True if successful
  • access: public
boolean write (string $remote, string $buffer, [int $mode = FTP_ASCII])
  • string $remote: FTP path to file to write to
  • string $buffer: Contents to write to the FTP server
  • int $mode: Transfer mode [1:Binary|0:Ascii] or use constants FTP_BINARY or FTP_ASCII [Defaults to Ascii]
_mode (line 1075)

Set transfer mode

  • return: True if successful
  • access: private
boolean _mode (int $mode)
  • int $mode: Integer representation of data transfer mode [1:Binary|0:Ascii] Defined constants can also be used [FTP_BINARY|FTP_ASCII]
_passive (line 1016)

Set server to passive mode and open a data port connection

  • return: True if successful
  • access: private
boolean _passive ()
_putCmd (line 955)

Send command to the FTP server and validate an expected response code

  • return: True if command executed successfully
  • access: private
boolean _putCmd (string $cmd, mixed $expectedResponse, mixed $expected)
  • string $cmd: Command to send to the FTP server
  • mixed $expected: Integer response code or array of integer response codes
_verifyResponse (line 978)

Verify the response code from the server and log response if flag is set

  • return: True if response code from the server is expected
  • access: private
boolean _verifyResponse (mixed $expected)
  • mixed $expected: Integer response code or array of integer response codes

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::JObject()
 JObject::get()
 JObject::set()
 JObject::toString()
 JObject::__destruct()

Documentation generated on Sat, 4 Feb 2006 14:23:36 +0100 by phpDocumentor 1.3.0RC4