PHP Class phpseclib\Net\SCP

Author: Jim Wigginton ([email protected])
Afficher le fichier Open project: phpseclib/phpseclib Class Usage Examples

Méthodes publiques

Свойство Type Description
$mode integer Mode
$packet_size integer Packet Size
$ssh object SSH Object

Méthodes publiques

Méthode Description
__construct ( SSH1 | SSH2 $ssh ) : SCP Default Constructor.
_close ( ) Closes the connection to an SSH server
_receive ( ) : string Receives a packet from an SSH server
_send ( string $data ) Sends a packet to an SSH server
get ( string $remote_file, string $local_file = false ) : mixed Downloads a file from the SCP server.
put ( string $remote_file, string $data, integer $mode = self::SOURCE_STRING, callable $callback = null ) : boolean Uploads a file to the SCP server.

Method Details

__construct() public méthode

Connects to an SSH server
public __construct ( SSH1 | SSH2 $ssh ) : SCP
$ssh SSH1 | SSH2
Résultat SCP

_close() public méthode

Closes the connection to an SSH server
public _close ( )

_receive() public méthode

Receives a packet from an SSH server
public _receive ( ) : string
Résultat string

_send() public méthode

Sends a packet to an SSH server
public _send ( string $data )
$data string

get() public méthode

Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the operation
public get ( string $remote_file, string $local_file = false ) : mixed
$remote_file string
$local_file string
Résultat mixed

put() public méthode

By default, \phpseclib\Net\SCP::put() does not read from the local filesystem. $data is dumped directly into $remote_file. So, for example, if you set $data to 'filename.ext' and then do \phpseclib\Net\SCP::get(), you will get a file, twelve bytes long, containing 'filename.ext' as its contents. Setting $mode to self::SOURCE_LOCAL_FILE will change the above behavior. With self::SOURCE_LOCAL_FILE, $remote_file will contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how large $remote_file will be, as well. Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take care of that, yourself.
public put ( string $remote_file, string $data, integer $mode = self::SOURCE_STRING, callable $callback = null ) : boolean
$remote_file string
$data string
$mode integer
$callback callable
Résultat boolean

Property Details

$mode public_oe property

Mode
public int $mode
Résultat integer

$packet_size public_oe property

Packet Size
public int $packet_size
Résultat integer

$ssh public_oe property

SSH Object
public object $ssh
Résultat object