4 $usage = "telnet host [port]\n";
5 if($argc > 1) $host = $argv[1]; else die($usage);
6 $port = 23; if($argc > 2) $port = $argv[2];
7 if($argc > 3) die($usage);
9 echo("Connecting to $host:$port...\n");
10 $sock = pfsockopen($host, $port);
11 if($sock) echo("Connected!\n\n"); else die("Failed!\n");
12 $stdin = fopen('php://stdin', 'r');
13 stream_set_blocking($sock, 0);
14 stream_set_blocking($stdin, 0);
16 while(!feof($sock) && !feof($stdin)) {
18 fwrite($sock, fgetc($stdin));
This page took 0.352974 seconds and 4 git commands to generate.