PABX da Simples IP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2 lines
3.5 KiB

<html><head> <title>PHP Telnet Users Manual</title> <style type="text/css"> body { background-color:#e3e3e3; } #everything { background-color:#fff; border:1px solid #ccc; padding:12px 20px; width:600px; margin:0 auto; } code { color:#063; } .indent { margin-left:25px; } </style></head><body><div id="everything"><h1>PHP Telnet Users Manual</h1><div class="indent"> by Antone Roundy</div><h2>Requirements</h2><div class="indent"> <p>PHP Telnet requires PHP version 4.3 or higher, with support for fsockopen enabled.</p></div><h2>Security</h2><div class="indent"> <p>I strongly recommend that you do not store your username and password in a PHP script unless only people you trust completely have access to your server. Instead, use a form to enter the username and password each time the script is run. Exercise caution with any system that transmits passwords over unencrypted connections.</p></div><h2>Installation</h2><div class="indent"> <p>To install PHP Telnet, simply upload it to your webserver.</p></div><h2>Usage</h2><div class="indent"> <p>The normal usage pattern for PHP Telnet is:</p> <ol> <li>Load PHP Telnet</li> <li>Create a PHPTelnet object</li> <li>Establish a telnet connection</li> <li>Send commands and process their results as desired</li> <li>Disconnect</li> </ol> <b>Basic usage</b><br /> <code> &lt;?php<br /> require_once "PHPTelnet.php";<br /><br /> $telnet = new PHPTelnet();<br /><br /> // if the first argument to Connect is blank,<br /> // PHPTelnet will connect to the local host via 127.0.0.1<br /> $result = $telnet->Connect('www.somewhere.com','login name','password');<br /><br /> if ($result == 0) { </code> <div style="margin:0 0 0 20px;"><code> $telnet->DoCommand('enter command here', $result);<br /> // NOTE: $result may contain newlines<br /> echo $result;<br /> $telnet->DoCommand('another command', $result);<br /> echo $result;<br /> // say Disconnect(0); to break the connection without explicitly logging out<br /> $telnet->Disconnect(); </code></div> <code> }<br /> ?&gt; </code><br /><br /> <b>Display your own error messages</b><br /> <code> &lt;?php<br /> require_once "PHPTelnet.php";<br /><br /> $telnet = new PHPTelnet();<br /> $telnet->show_connect_error=0;<br /><br /> // if the first argument to Connect is blank,<br /> // PHPTelnet will connect to the local host via 127.0.0.1<br /> $result = $telnet->Connect('www.somewhere.com','login name','password');<br /><br /> switch ($result) {<br /> case 0: </code> <div style="margin:0 0 10px 20px;"><code> $telnet->DoCommand('enter command here', $result);<br /> // NOTE: $result may contain newlines<br /> echo $result;<br /> $telnet->DoCommand('another command', $result);<br /> echo $result;<br /> // say Disconnect(0); to break the connection without explicitly logging out<br /> $telnet->Disconnect();<br /> break; </code></div> <code> case 1:<br /> </code> <div style="margin:0 0 10px 20px;"><code> echo '[PHP Telnet] Connect failed: Unable to open network connection';<br /> break; </code></div> <code> case 2:<br /> </code> <div style="margin:0 0 10px 20px;"><code> echo '[PHP Telnet] Connect failed: Unknown host';<br /> break; </code></div> <code> case 3:<br /> </code> <div style="margin:0 0 10px 20px;"><code> echo '[PHP Telnet] Connect failed: Login failed';<br /> break; </code></div> <code> case 4:<br /> </code> <div style="margin:0 0 10px 20px;"><code> echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet';<br /> break; </code></div> <code> }<br /> ?&gt; </code></div></div></body></html>