miyahan/telnet

Telnet client in php

1.1.2 2015-12-15 11:40 UTC

This package is not auto-updated.

Last update: 2024-11-10 20:08:07 UTC


README

Telnet client written in php

Description

  • Telnet to Linux/UNIX servers
  • Telnet to network routeres (Cisco IOS , Juniper JUNOS)

Requirement

  • PHP 5.6 or later (PHP 7.0 ready!)

Usage

Telnet to Cisco IOS router

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();
}

Installation

Use composer (https://packagist.org/packages/miyahan/telnet)

Author

License

MIT