Conexion Telnet con Php
Publicado por Andix (2 intervenciones) el 11/06/2015 19:19:51
Hola!!
Tengo el siguiente problema: Necesito conectarme vía telnet usando php, para después ejecutar un script alojado en dicho servidor ... mi servidor es windws y el remoto es linux.
Espero alguien me pueda ayudar, soy nuevo en esto y quisiera saber si algo anda mal en mi código, ya que cuando intento probarlo me aparece el error:
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed (10060)"
Mi código es el siguiente:
Tengo el siguiente problema: Necesito conectarme vía telnet usando php, para después ejecutar un script alojado en dicho servidor ... mi servidor es windws y el remoto es linux.
Espero alguien me pueda ayudar, soy nuevo en esto y quisiera saber si algo anda mal en mi código, ya que cuando intento probarlo me aparece el error:
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed (10060)"
Mi código es el siguiente:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
$ip=$_REQUEST['puerto'];
$usuario=$_REQUEST['usuario'];
$pass=$_REQUEST['pass'];
$COMANDOS=$_REQUEST['comandos'];
$da = fsockopen($ip, 23, $errno, $errstr, 50);
if (!$da) {
echo "$errstr ($errno)<br />\n";
} else {
$salida = "$usuario \r\n";
$salida .= "$pass \r\n";
$salida .= "$COMANDOS\r\n";
$salida .= "exit\r\n";
fwrite($da, $salida);
while (!feof($da)) {
echo fgets($da, 128);
}
fclose($da);
}
?>
Valora esta pregunta


0