PHP to Telnet
来源:互联网 发布:医药类数据库有哪些 编辑:程序博客网 时间:2024/05/16 18:37
刚刚发现通过PHP, 用telnet方式连接UNIX server 的方法。 RoX~1)etH
.R[eFTYba
这个是一个class 文件. 通过这个class, 可以实现PHP to Telnet 啦。 P1{ub k
�aa+ny
you can download the class here: PHPTelnet Class kb<_ke
o/:u7W?
Usage Examples: f7WQ~j@ML
Q0@&^vThq
Basic usage }]_)`
NOTE: With PHP Telnet versions before 1.1, the following code will not display error messages for certain types of connection failures. If you are using an older version, either upgrade to the current version or use the next code example. N�xUy]fc
1IS( S/
<?php r-{CG_
require_once "PHPTelnet.php"; 2�A;8/Q-
-%5d/@.
$telnet = new PHPTelnet(); VT!@0l`'//
!V%S{)n
// if the first argument to Connect is blank, 1%(.p7I`G
// PHPTelnet will connect to the local host via 127.0.0.1 +0 4+E,Y
$result = $telnet->Connect('www.somewhere.com','login name','password'); ABt/YZ
wVBs'TKX
if ($result == 0) { Yy!<Tvr~
$telnet->DoCommand('enter command here', $result); uxW 52NNQ
// NOTE: $result may contain newlines 3S8 ;y9'
echo $result; G,7,:S}0~X
$telnet->DoCommand('another command', $result); w/jc"3 >|^
echo $result; S=!e[){
// say Disconnect(0); to break the connection without explicitly logging out m` IPn(;o
$telnet->Disconnect(); >/GOf
} lYc !i6B
?> (F�36.)
xI gh :
Display your own error messages )Vf`N :0U
NOTE: With PHP Telnet versions before 1.1, the show_connect_error option was not supported. If you are using an older version, either upgrade to the current version, or delete the line that sets show_connect_error. 5N$Q>6,8
~ ,<UQ
<?php PH!U[jT
require_once "PHPTelnet.php"; )D+y{zmd"
'RwmN.QH|
$telnet = new PHPTelnet(); 1^D-c$
$telnet->show_connect_error=0; 8@[?7-MEIy
BdD FYV
// if the first argument to Connect is blank, RuZ%`Ss
// PHPTelnet will connect to the local host via 127.0.0.1 91x6'I8G
$result = $telnet->Connect('www.somewhere.com','login name','password'); y�9{O& yOx
ld+] |,P
switch ($result) { ^ezY<V
case 0: ?a-J h
$telnet->DoCommand('enter command here', $result); ~J}Mzhe~
// NOTE: $result may contain newlines B ^:P R
echo $result; 4�MANDq{
$telnet->DoCommand('another command', $result); PIx 0x
echo $result; q}L�o.
// say Disconnect(0); to break the connection without explicitly logging out -1U3l-R
$telnet->Disconnect(); x ) )"dK
break; DvJaiLMZG
case 1: =cWHwdy5
echo '[PHP Telnet] Connect failed: Unable to open network connection'; )B X3r^
break; 0'hz:%
case 2: C}@|8Qk_
echo '[PHP Telnet] Connect failed: Unknown host'; 6:2(+WV
break; eR<-YxQea
case 3: %$#nAGnqr
echo '[PHP Telnet] Connect failed: Login failed'; S?'.(E
break; aYQncud/
case 4: ]s+"GE=6
echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet'; ikOK-u&*
break; mnEA`
} Pi.2IbN>~
?>
.R[eFTYba
这个是一个class 文件. 通过这个class, 可以实现PHP to Telnet 啦。 P1{ub k
�aa+ny
you can download the class here: PHPTelnet Class kb<_ke
o/:u7W?
Usage Examples: f7WQ~j@ML
Q0@&^vThq
Basic usage }]_)`
NOTE: With PHP Telnet versions before 1.1, the following code will not display error messages for certain types of connection failures. If you are using an older version, either upgrade to the current version or use the next code example. N�xUy]fc
1IS( S/
<?php r-{CG_
require_once "PHPTelnet.php"; 2�A;8/Q-
-%5d/@.
$telnet = new PHPTelnet(); VT!@0l`'//
!V%S{)n
// if the first argument to Connect is blank, 1%(.p7I`G
// PHPTelnet will connect to the local host via 127.0.0.1 +0 4+E,Y
$result = $telnet->Connect('www.somewhere.com','login name','password'); ABt/YZ
wVBs'TKX
if ($result == 0) { Yy!<Tvr~
$telnet->DoCommand('enter command here', $result); uxW 52NNQ
// NOTE: $result may contain newlines 3S8 ;y9'
echo $result; G,7,:S}0~X
$telnet->DoCommand('another command', $result); w/jc"3 >|^
echo $result; S=!e[){
// say Disconnect(0); to break the connection without explicitly logging out m` IPn(;o
$telnet->Disconnect(); >/GOf
} lYc !i6B
?> (F�36.)
xI gh :
Display your own error messages )Vf`N :0U
NOTE: With PHP Telnet versions before 1.1, the show_connect_error option was not supported. If you are using an older version, either upgrade to the current version, or delete the line that sets show_connect_error. 5N$Q>6,8
~ ,<UQ
<?php PH!U[jT
require_once "PHPTelnet.php"; )D+y{zmd"
'RwmN.QH|
$telnet = new PHPTelnet(); 1^D-c$
$telnet->show_connect_error=0; 8@[?7-MEIy
BdD FYV
// if the first argument to Connect is blank, RuZ%`Ss
// PHPTelnet will connect to the local host via 127.0.0.1 91x6'I8G
$result = $telnet->Connect('www.somewhere.com','login name','password'); y�9{O& yOx
ld+] |,P
switch ($result) { ^ezY<V
case 0: ?a-J h
$telnet->DoCommand('enter command here', $result); ~J}Mzhe~
// NOTE: $result may contain newlines B ^:P R
echo $result; 4�MANDq{
$telnet->DoCommand('another command', $result); PIx 0x
echo $result; q}L�o.
// say Disconnect(0); to break the connection without explicitly logging out -1U3l-R
$telnet->Disconnect(); x ) )"dK
break; DvJaiLMZG
case 1: =cWHwdy5
echo '[PHP Telnet] Connect failed: Unable to open network connection'; )B X3r^
break; 0'hz:%
case 2: C}@|8Qk_
echo '[PHP Telnet] Connect failed: Unknown host'; 6:2(+WV
break; eR<-YxQea
case 3: %$#nAGnqr
echo '[PHP Telnet] Connect failed: Login failed'; S?'.(E
break; aYQncud/
case 4: ]s+"GE=6
echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet'; ikOK-u&*
break; mnEA`
} Pi.2IbN>~
?>
- PHP to Telnet
- introduction to TELNET
- Telnet to Moto A780
- how to telnet a phone?
- telnet :No route to host
- telnet to switch by java
- Telnet to your Android device
- Telnet to PIX Firewall From Outside Interface
- telnet localhost to login guest domain failed.
- how to setup telnet in ubuntu
- Telnet/SSH to Fedore Server Very Slow
- TELNET “no router to host”错误问题解决
- PHP+Socket聊天室(telnet命令调试)
- linux telnet 之 telnet: Unable to connect to remote host: Connection refused
- telnet
- Telnet
- telnet
- Telnet
- Can't connect to MySQL server on 'localhost' (10048)
- 猫大叫一声,所有的老鼠都开始逃跑,主人被惊醒
- export data from mySQL to csv
- 把一个变量变成integer
- find & replace text tool
- PHP to Telnet
- 會變魔術的DreamMail
- MySQL: Incorrect key file, try to repair it
- J2EE开发之常用开源项目介绍
- undefined function imagecreatefromjpeg()
- 关于pear
- apt-get 命令
- Install PEAR Problem
- server transfer