PHP code example of miyahan / telnet
1. Go to this page and download the library: Download miyahan/telnet library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
miyahan / telnet example snippets
try {
$telnet = new \miyahan\network\Telnet('10.0.0.1');
$telnet->connect();
$telnet->login('username', 'password', 'ios');
$telnet->exec('terminal length 0');
$telnet->exec('enable'."\r\n".'secret');
$telnet->setPrompt('router#');
$result = $telnet->exec('show env all');
echo $result."\n";
} catch (Exception $e) {
echo $e->getMessage();
}