FTP
[ class tree: FTP ] [ index: FTP ] [ all elements ]

File: Socket.php

Source Location: /Net_FTP-1.4.0/Net/FTP/Socket.php

Classes:

Page Details:

Net_FTP socket implementation of FTP functions.

The functions in this file emulate the ext/FTP functions through ext/Socket.

PHP versions 4 and 5


FTP_ASCII [line 26]

FTP_ASCII = 0
Default FTP extension constants

[ Top ]



FTP_BINARY [line 28]

FTP_BINARY = 1

[ Top ]



FTP_IMAGE [line 29]

FTP_IMAGE = 1

[ Top ]



FTP_TEXT [line 27]

FTP_TEXT = 0

[ Top ]



FTP_TIMEOUT_SEC [line 30]

FTP_TIMEOUT_SEC = 0

[ Top ]



ftp_alloc [line 525]

boolean ftp_alloc( resource &$control, integer $int, [string &$msg = null])

boolean ftp_alloc ( resource stream, integer bytes [, string &message ] );

Allocates space for a file to be uploaded Return TRUE on success or FALSE on failure

NOTE; Many FTP servers do not support this command and/or don't need it.

FTP success respons key: Belive it's 200 Needs data connection: NO

  • Access: public


Parameters

resource   &$control   FTP stream
integer   $int   Space to allocate
string   &$msg   Optional, textual representation of the servers response will be returned by reference
[ Top ]



ftp_cdup [line 704]

boolean ftp_cdup( integer &$control)

Changes to the parent directory Returns TRUE on success or FALSE on failure
  • Access: public


Parameters

integer   &$control   Stream ID
[ Top ]



ftp_chdir [line 259]

boolean ftp_chdir( resource &$control, string $pwd)

boolean ftp_chdir ( resource stream, string directory );

Changes the current directory to the specified directory. Returns TRUE on success or FALSE on failure.

FTP success response code: 250 Needs data connection: NO

  • Access: public


Parameters

resource   &$control   FTP stream
string   $pwd   Directory name
[ Top ]



ftp_chmod [line 733]

integer ftp_chmod( integer &$control, integer $mode, string $file)

Set permissions on a file via FTP Returns the new file permission on success or false on error

NOTE: This command is *not* supported by the standard NOTE: This command not ready!

  • Todo: Figure out a way to chmod files via FTP
  • Access: public


Parameters

integer   &$control   Stream ID
integer   $mode   Octal value
string   $file   File to change permissions on
[ Top ]



ftp_close [line 197]

boolean ftp_close( resource &$control)

Alias to ftp_quit()


Parameters

resource   &$control   FTP resource
[ Top ]



ftp_connect [line 66]

&resource &ftp_connect( string $host, [int $port = 21], [int $timeout = 90])

&resource ftp_connect ( string host [, int port [, int timeout ] ] );

Opens an FTP connection and return resource or false on failure.

FTP Success respons code: 220

  • Todo: The FTP extension has ftp_set_option() function which sets the timeout variable. This function needs to be created and called here.
  • Todo: The FTP extension has ftp_get_option() function which returns the timeout variable. This function needs to be created and contain it as static variable.
  • Access: public


Parameters

string   $host   Host to connect to
int   $port   Optional, port to connect to
int   $timeout   Optional, seconds until function timeouts
[ Top ]



ftp_delete [line 766]

boolean ftp_delete( integer &$control, string $path)

Deletes a file on the FTP server Returns TRUE on success or FALSE on failure
  • Access: public


Parameters

integer   &$control   Stream ID
string   $path   File to delete
[ Top ]



ftp_exec [line 796]

boolean ftp_exec( integer &$control, string $cmd)

Requests execution of a program on the FTP server NOTE; SITE EXEC is *not* supported by the standart Returns TRUE on success or FALSE on error
  • Todo: Look a littlebit better into this
  • Access: public


Parameters

integer   &$control   Stream ID
string   $cmd   Command to send
[ Top ]



ftp_get [line 659]

boolean ftp_get( integer &$control, string $local, string $remote, integer $mode, [integer $resume = 0])

Retrieve a remote file to a local file Returns TRUE on success or FALSE on failure
  • Access: public


Parameters

integer   &$control   Stream ID
string   $local   Local filename
string   $remote   Remote filename
integer   $mode   Transfer mode (FTP_ASCII or FTP_BINARY)
integer   $resume   Resume the file transfer or not
[ Top ]



ftp_login [line 121]

boolean ftp_login( resource &$control, string $username, string $password)

boolean ftp_login ( resource stream, string username, string password );

Logs in to an given FTP connection stream. Returns TRUE on success or FALSE on failure.

NOTE: Username and password are *not* optional. Function will *not* assume "anonymous" if username and/or password is empty

FTP Success respons code: 230

  • Access: public


Parameters

resource   &$control   FTP resource to login to
string   $username   FTP Username to be used
string   $password   FTP Password to be used
[ Top ]



ftp_pasv [line 309]

boolean ftp_pasv( stream &$control, boolean $pasv)

boolean ftp_pasv ( resource stream, boolean passive );

Toggles passive mode ON/OFF. Returns TRUE on success or FALSE on failure.

Comment: Although my lack of C knowlege I checked how the PHP FTP extension do things here. Seems like they create the data connection and store it in object for other functions to use. This is now done here.

FTP success response code: 227

  • Access: public


Parameters

stream   &$control   FTP stream
boolean   $pasv   True to switch to passive, false for active mode
[ Top ]



ftp_put [line 564]

boolean ftp_put( resource &$control, string $remote, string $local, integer $mode, [integer $pos = 0])

bool ftp_put ( resource stream, string remote_file, string local_file, int mode [, int startpos ] );

Uploads a file to the FTP server Returns TRUE on success or FALSE on failure.

NOTE: The transfer mode specified must be either FTP_ASCII or FTP_BINARY.

  • Access: public


Parameters

resource   &$control   FTP stream
string   $remote   Remote file to write
string   $local   Local file to upload
integer   $mode   Upload mode, FTP_ASCI || FTP_BINARY
integer   $pos   Optional, start upload at position
[ Top ]



ftp_pwd [line 218]

string ftp_pwd( resource &$control)

string ftp_pwd ( resource stream );

Gets the current directory name. Returns the current directory.

Needs data connection: NO Success response code: 257

  • Access: public


Parameters

resource   &$control   FTP resource
[ Top ]



ftp_quit [line 174]

boolean ftp_quit( resource &$control)

boolean ftp_quit ( resource stream );

Closes FTP connection. Returns TRUE or FALSE on error.

NOTE: The PHP function ftp_quit is *alias* to ftp_close, here it is the *other-way-around* ( ftp_close() is alias to ftp_quit() ).

NOTE: resource is set to null since unset() can't unset the variable.

  • Access: public


Parameters

resource   &$control   FTP resource
[ Top ]



ftp_rawlist [line 416]

array ftp_rawlist( integer &$control, string $pwd, [boolean $recursive = false])

array ftp_rawlist ( resource stream, string directory [,bool recursive] );

Returns a detailed list of files in the given directory.

Needs data connection: YES

  • Todo: Enable the recursive feature.
  • Access: public


Parameters

integer   &$control   FTP resource
string   $pwd   Path to retrieve
boolean   $recursive   Optional, retrieve recursive listing
[ Top ]



ftp_systype [line 487]

string ftp_systype( resource &$control)

string ftp_systype ( resource stream );

Gets system type identifier of remote FTP server Returns the remote system type

  • Access: public


Parameters

resource   &$control   FTP resource
[ Top ]



Documentation generated on Mon, 11 Mar 2019 16:01:42 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.