[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/phpseclib/phpseclib/phpseclib/Net/ -> SCP.php (summary)

Pure-PHP implementation of SCP. PHP version 5

Author: Jim Wigginton
Copyright: 2010 Jim Wigginton
License: http://www.opensource.org/licenses/mit-license.html MIT License
Link: http://phpseclib.sourceforge.net
File Size: 342 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SCP:: (6 methods):
  __construct()
  put()
  get()
  _send()
  _receive()
  _close()


Class: SCP  - X-Ref

Pure-PHP implementations of SCP.

__construct($ssh)   X-Ref
Default Constructor.

Connects to an SSH server

return: \phpseclib\Net\SCP
param: \phpseclib\Net\SSH1|\phpseclib\Net\SSH2 $ssh

put($remote_file, $data, $mode = self::SOURCE_STRING, $callback = null)   X-Ref
Uploads a file to the SCP server.

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.

return: bool
param: string $remote_file
param: string $data
param: int $mode
param: callable $callback

get($remote_file, $local_file = false)   X-Ref
Downloads a file from the SCP server.

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

return: mixed
param: string $remote_file
param: string $local_file

_send($data)   X-Ref
Sends a packet to an SSH server

param: string $data

_receive()   X-Ref
Receives a packet from an SSH server

return: string

_close()   X-Ref
Closes the connection to an SSH server