English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

//Display info upon entering the page.
$fp = fsockopen($host,$port,$errno,$errstr);

if(!$fp)
{
$results = "Error: could not open socket connection";
}
else
{
fputs ($fp, $login_info[2]."\n");//telnet password
fputs ($fp, "en\n");//enable
fputs ($fp, $login_info[3]."\n");//secret password
fputs ($fp, "terminal length 0\n");//show complete list of info without pausing
fputs ($fp, "show run\n");//show run config. command
fputs ($fp, "\r");//enter key

fgets ($fp, 1024);//ÿûÿûÿýÿý

while(true)
{
$tmpecho = fgets ($fp, 1024);

//Hide the string of terminal length 0
if(stristr($tmpecho,'terminal length 0') === FALSE )
{
$moredetails .= $tmpecho;
}

//break from the loop
if(substr($tmpecho,0,3) =='end')
{
fputs ($fp, "\r");
$moredetails .= fgets ($fp, 1024);
$moredetails .= fgets ($fp, 1024);
break;
}
}
}
fclose($fp);

2006-10-05 00:47:51 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

Tell us your problem, and we might be able to help. Cause You just gave us code with no objective or question.

thx

2006-10-05 14:58:29 · answer #1 · answered by ? 6 · 0 0

fedest.com, questions and answers