dev-master
9999999-devProvide an interactive ssh connection.
MIT
The Requires
- php >=5.3.2
- ext-ssh2 *
- phpunit/phpunit ~4.3
by Rannk Deng
ssh ssh2 interactive
Wallogit.com
2017 © Pedro Peláez
Provide an interactive ssh connection.
provide an interactive ssh connection., (*1)
You need PHP version 5.3+ with the SSH2 extension., (*2)
The best way to add the library to your project is using composer., (*3)
$ composer require rannk/php-interactive-ssh:dev-master
This wraaper tool is very eash to use. But now we just provide using username and password to access the ssh connection., (*4)
step 1: instance a connection object, (*5)
<?php $conn = new ssh\Connection(hostname, [port]); $conn->authByPassword(username, password);
setp 2: create a session, (*6)
<?php $session = $conn->createSession();
setp 3: send your command, (*7)
<?php
$session->expect('$');
$session->send('ls');
$session->expect('$');
session::expect(expect_word, expire_time, display_message) return String, (*8)
expect_word(String): which word you expected waiting for when you want to run next command expire_time(int): The default is 0. set the waiting for time. The zero mean always wait. display_message(boolean): To set true is mean display the output message that from command.
session::send(command) return void, (*9)
command(String): The shell command
Provide an interactive ssh connection.
MIT
ssh ssh2 interactive