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

File: Socket.php

Source Location: /Net_FTP-1.3.2/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

LICENSE: This source file is subject to version 3.0 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_0.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.


FTP_ASCII [line 34]

FTP_ASCII = 0
Default FTP extension constants

[ Top ]



FTP_BINARY [line 36]

FTP_BINARY = 1

[ Top ]



FTP_IMAGE [line 37]

FTP_IMAGE = 1

[ Top ]



FTP_TEXT [line 35]

FTP_TEXT = 0

[ Top ]



FTP_TIMEOUT_SEC [line 38]

FTP_TIMEOUT_SEC = 0

[ Top ]



ftp_alloc [line 488]

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

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



Parameters

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



ftp_cdup [line 644]

boolean ftp_cdup( &$control, integer $stream)

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


Parameters

integer   $stream   ( Stream ID )
   &$control  
[ Top ]



ftp_chdir [line 241]

boolean ftp_chdir( &$control, string $pwd, integer $stream)

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 respons code: 250 Needs data connection: NO



Parameters

integer   $stream   ( FTP stream )
string   $pwd   ( Directory name )
   &$control  
[ Top ]



ftp_chmod [line 670]

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

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 standart TODO: Figure out a way to chmod files via FTP NOTE: This command not ready!

  • Access: public


Parameters

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



ftp_close [line 187]

void ftp_close( &$control)

Alias to ftp_quit()


Parameters

   &$control  
[ Top ]



ftp_connect [line 74]

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

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

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

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.

TODO: The FTP extension has ftp_set_option() function which sets the timeout variable. This function needs to be created and called here.

FTP Success respons code: 220



Parameters

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



ftp_delete [line 699]

boolean ftp_delete( &$control, string $path)

Deletes a file on the FTP server Returns TRUE on success or FALSE on failure


Parameters

string   $path   ( File to delete )
   &$control  
[ Top ]



ftp_exec [line 727]

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

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   $stream   ( Stream ID )
string   $cmd   ( Command to send )
   &$control  
[ Top ]



ftp_get [line 603]

void ftp_get( &$control, $local, $remote, $mode, [ $resume = 0])



Parameters

   &$control  
   $local  
   $remote  
   $mode  
   $resume  
[ Top ]



ftp_login [line 122]

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

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



Parameters

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



ftp_pasv [line 286]

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

boolean ftp_pasv ( resource stream, boolean passive );

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

Comment: Althou my lack of C knowlage 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 respons code: 227



Parameters

stream   $control   ( FTP stream )
   &$control  
   $pasv  
[ Top ]



ftp_put [line 523]

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

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.



Parameters

resource   $stream   ( 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 )
   &$control  
[ Top ]



ftp_pwd [line 204]

string ftp_pwd( &$control, integer $stream)

string ftp_pwd ( resource stream );

Gets the current directory name. Returns the current directory.

Needs data connection: NO Success respons code: 257



Parameters

integer   $stream   ( FTP resource )
   &$control  
[ Top ]



ftp_quit [line 172]

boolean ftp_quit( &$control, integer $stream)

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.



Parameters

integer   $stream   ( FTP resource )
   &$control  
[ Top ]



ftp_rawlist [line 387]

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

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

Returns a detailed list of files in the given directory.

TODO: Enable the recursive feature.

Needs data connection: YES



Parameters

integer   $stream   ( FTP resource )
string   $pwd   ( Path to retrive )
boolean   $recursive   ( Optional, retrive recursive listing )
   &$control  
[ Top ]



ftp_systype [line 453]

string ftp_systype( &$control, resource $stream)

string ftp_systype ( resource stream );

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



Parameters

resource   $stream   ( FTP resource )
   &$control  
[ Top ]



Documentation generated on Mon, 11 Mar 2019 14:36:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.