I am trying to use the telnet-client to display a cli replica output. Below is the commands I need to execute but I don't appear to get a connection.
<?php
require "vendor/autoload.php";
$client = Graze\TelnetClient\TelnetClient::factory();
$dsn = "00.00.00.000:23";
$client->connect($dsn, "login:");
$command1 = "LOGIN";
$prompt = "password:";
$resp1 = $client->execute($command1, $prompt);
var_dump($resp1);
$command2 = "PASSWORD";
$prompt = "FOC-LABS-02>";
$resp2 = $client->execute($command2, $prompt);
var_dump($resp2);
$command3 = "bridge show";
$prompt = "<SPACE> for next page, <CR> for next line, A for all, Q to quit";
$resp3 = $client->execute($command3, $prompt);
var_dump($resp3);
$command4 = "a";
$prompt = "[0-9] Bridge Interfaces displayed"; // this is the last word displayed after all data is returned
$resp4 = $client->execute($command4, $prompt);
var_dump($resp4);
```
When I just run the connect code
```
$dsn = "10.45.10.100:23";
$client->connect($dsn);
echo "<pre>";
print_r($client);
echo "</pre>";
```
```
The response is
Graze\TelnetClient\TelnetClient Object
(
[socketFactory:protected] => Socket\Raw\Factory Object
(
)
[promptMatcher:protected] => Graze\TelnetClient\PromptMatcher Object
(
[matches:protected] => Array
(
)
[responseText:protected] =>
)
[interpretAsCommand:protected] => Graze\TelnetClient\InterpretAsCommand Object
(
[WILL:protected] => �
[WONT:protected] => �
[DO:protected] => �
[DONT:protected] => �
[IAC:protected] => �
)
[prompt:protected] => \$
[promptError:protected] => ERROR
[lineEnding:protected] =>
[maxBytesRead:protected] => 0
[socket:protected] => Socket\Raw\Socket Object
(
[resource:Socket\Raw\Socket:private] => Socket Object
(
)
)
[buffer:protected] =>
[NULL:protected] =>
[DC1:protected] => �
[IAC:protected] =>
)
```
I'm not sure what to look for, any ideas?
I am trying to use the telnet-client to display a cli replica output. Below is the commands I need to execute but I don't appear to get a connection.