Re: [PHP] Telnet

2002-02-22 Thread DrouetL


Hi,

you can find all what you want on the following url :
http://phpclasses.upperdesign.com/browse.html/class/2/

Personnaly I use the SMTP class from Richard Heyes

Laurent



   
  
Uma Shankari T.  
  
[EMAIL PROTECTED]   To: [EMAIL PROTECTED]   
  
et.res.in cc: 
  
   Subject: [PHP] Telnet   
  
22/02/02 05:17 
  
   
  
   
  





 Hello,


  By using telnet option how i will send a mail from my machine using
 php..If any one came to know this plz tell me how to do it...


-Uma


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Telnet

2002-02-22 Thread bvr



You can send mail using PHP's  mail() function.

On windows this works with regular SMTP (mail server), 
on UNIX it executes a binary (local delivery agent) that 
may handle the message as desired.

If you really want to sent through a  telnet service, you can
fsockopen() to the telnet server and regular file functions 
to send login stuff and run the appropiatemail software on 
the server ('sendmail'?).

Ofcourse this is not recommended, because it has unnecessary
overhead and you'd be better off using an SMTP script or class
(as noted before) or make one yourself according to the 'SMTP RFC'
(put that in google).


bvr.


On Fri, 22 Feb 2002 09:47:08 +0530 (IST), Uma Shankari T. wrote:


 Hello,


  By using telnet option how i will send a mail from my machine using 
 php..If any one came to know this plz tell me how to do it...


-Uma


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php telnet

2001-12-20 Thread Thies C. Arntzen


the attached file implements a minimal telnet client and is
free to use.

re,
tc

On Wed, Dec 19, 2001 at 02:16:36PM -0800, Chris Lee wrote:
 if I nc to my server on port 23 I get the same thing. ie there is nothing
 wrong. your going to have to emulate the telnet protocal now, thats just the
 connect string.
 
 --
 
   Chris Lee
   [EMAIL PROTECTED]
 
 
 
 
 Kancha [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
  The following code generated garbase output. what is wrong ??
 
  ?php
$sp = fsockopen(localhost, 23);
if(!$sp){
  echo error;
  exit;
}
socket_set_blocking($sp, FALSE);
 
function getLine(){
  global $sp;
 
  $op = fgets($sp, 1024);
  while(empty($op)){
$op = fgets($sp, 1024);
  }
  return $op;
}
 
echo getLine();
  ?
 
  The output was as follows:
 
  [root@ispms html]# php telnet.php
  X-Powered-By: PHP/4.1.0
  Content-type: text/html
 
  ÿý?ÿý ÿý#ÿý'[root@ispms html]#
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


?
error_reporting(-1);

class Telnet {
// [EMAIL PROTECTED] 2001

var $sock = NULL;

function telnet($host,$port) {
$this-sock = fsockopen($host,$port);
socket_set_timeout($this-sock,2,0);
}   

function close() {
if ($this-sock)
fclose($this-sock);
$this-sock = NULL;
}

function write($buffer) {
$buffer = str_replace(chr(255),chr(255).chr(255),$buffer);
fwrite($this-sock,$buffer); 
}

function getc() {
return fgetc($this-sock);
}

function read_till($what)  {
$buf = '';
while (1) {
$IAC  = chr(255); 

$DONT = chr(254);
$DO   = chr(253);

$WONT = chr(252);
$WILL = chr(251);

$theNULL = chr(0);

$c = $this-getc();

if ($c === false) 
  return $buf;

if ($c == $theNULL) {
continue;
}

if ($c == \021) {
continue;
}

if ($c != $IAC) {
$buf .= $c;

if ($what == 
(substr($buf,strlen($buf)-strlen($what {
return $buf;
} else { 
continue;
}
}

$c = $this-getc();

if ($c == $IAC) {
$buf .= $c;
} else if (($c == $DO) || ($c == $DONT)) {
$opt = $this-getc();
//  echo we wont .ord($opt).\n;
fwrite($this-sock,$IAC.$WONT.$opt); 
} elseif (($c == $WILL) || ($c == $WONT)) {
$opt = $this-getc(); 
//  echo we dont .ord($opt).\n;
fwrite($this-sock,$IAC.$DONT.$opt); 
} else {
//  echo where are we? c=.ord($c).\n;
}
}

}
}

$tn = new telnet(192.168.255.100,23);
echo $tn-read_till(ogin: );
$tn-write(admin\r\n);
echo $tn-read_till(word: );
$tn-write(thieso\r\n);
echo $tn-read_till(: );
$tn-write(ps\r\n);
echo $tn-read_till(: );
echo $tn-close();
?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP] Re: php telnet

2001-12-19 Thread Chris Lee

if I nc to my server on port 23 I get the same thing. ie there is nothing
wrong. your going to have to emulate the telnet protocal now, thats just the
connect string.

--

  Chris Lee
  [EMAIL PROTECTED]




Kancha [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 The following code generated garbase output. what is wrong ??

 ?php
   $sp = fsockopen(localhost, 23);
   if(!$sp){
 echo error;
 exit;
   }
   socket_set_blocking($sp, FALSE);

   function getLine(){
 global $sp;

 $op = fgets($sp, 1024);
 while(empty($op)){
   $op = fgets($sp, 1024);
 }
 return $op;
   }

   echo getLine();
 ?

 The output was as follows:

 [root@ispms html]# php telnet.php
 X-Powered-By: PHP/4.1.0
 Content-type: text/html

 ÿý?ÿý ÿý#ÿý'[root@ispms html]#




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] telnet or ssh in PHP (Curl?)

2001-12-17 Thread Bas van Rooijen


Hi Bas!

SSH is possible but complicated.

For telnet, simply use fsockopen() (default telnet port is 23).

This returns a filepointer so you can read/write like as a regular file.

greets,
Bas van Rooijen


On Mon, 17 Dec 2001 17:28:04 +0100, Bas van Schaik wrote:

Hello everybody!

I need some help. I want to use a SSH (or, if SSH is impossible, telnet)
connection in PHP. But I can't find anything about it. The only thing about
telnet in the PHP manual (English), is that Curl supports it, but how? Tanks
in advance for all replies!

Bas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] telnet or ssh in PHP (Curl?)

2001-12-17 Thread Sterling Hughes

 
 Hi Bas!
 
 SSH is possible but complicated.

Not really, just create a tunnel...

-Sterling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Telnet and PHP

2001-07-01 Thread Warren Vail

Jon,

Looked like a nice solution, but couldn't get the code to work.  Kept going
into an endless loop or wait state somewhere.

still forced to use rexec.

Warren Vail

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 11:06 AM
To: Warren Vail
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Telnet and PHP


Instead of performing a send for each stroke, the user code type in a whole
string in a text box, and then submit that string. I have found this code at
http://www.phpbuilder.com/mail/php-general/2001051/1479.php:

?
error_reporting(-1);


class Telnet {
/* (c) [EMAIL PROTECTED] */


var $sock = NULL;


function telnet($host,$port) {
$this-sock = fsockopen($host,$port);
socket_set_timeout($this-sock,2,0);
}


function close() {
if ($this-sock)
fclose($this-sock);
$this-sock = NULL;
}


function write($buffer) {
$buffer = str_replace(chr(255),chr(255).chr(255),$buffer);
fwrite($this-sock,$buffer);
}


function getc() {
return fgetc($this-sock);
}


function read_till($what) {
$buf = '';
while (1) {
$IAC = chr(255);


$DONT = chr(254);
$DO = chr(253);


$WONT = chr(252);
$WILL = chr(251);


$theNULL = chr(0);


$c = $this-getc();


if ($c === false)
  return $buf;


if ($c == $theNULL) {
continue;
}


if ($c == \021) {
continue;
}


if ($c != $IAC) {
$buf .= $c;


if ($what ==
(substr($buf,strlen($buf)-strlen($what {
return $buf;
} else {
continue;
}
}


$c = $this-getc();


if ($c == $IAC) {
$buf .= $c;
} else if (($c == $DO) || ($c == $DONT)) {
$opt = $this-getc();
// echo we wont .ord($opt).\n;
fwrite($this-sock,$IAC.$WONT.$opt);
} elseif (($c == $WILL) || ($c == $WONT)) {
$opt = $this-getc();
// echo we dont .ord($opt).\n;
fwrite($this-sock,$IAC.$DONT.$opt);
} else {
// echo where are we? c=.ord($c).\n;
}
}


}
}


$tn = new telnet(192.168.255.100,23);
echo $tn-read_till(ogin: );
$tn-write(admin\r\n);
echo $tn-read_till(word: );
$tn-write(thieso\r\n);
echo $tn-read_till(: );
$tn-write(ps\r\n);
echo $tn-read_till(: );
echo $tn-close();
?





- Original Message -
From: Warren Vail [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, June 30, 2001 2:01 PM
Subject: RE: [PHP] Telnet and PHP


 By active user input, I would assume that you mean every time the user
 makes a keystroke, the keystroke is sent to the host machine.  This is not
a
 characteristic of html which only sends information to the host machine
when
 some form of submit is clicked.  The advantage of the applet for this sort
 of thing is it runs on the browser client, and has the capability of
sending
 every keystroke directly to the host, bypassing the server side.

 On the server side, once the (PHP) application is done sending the
requested
 files to the web browser for one user, it moves on to handling the
requests
 for other users.  Can you imagine the load on a server if it had to reload
 your application every time, your user pressed a key.

 You never really made it clear where you expected this client to run,
 although PHP, at this point, can only run on the server.  Now if you are
 looking for something that your PHP code could use to 1. signon to a host
 somewhere, 2. execute some commands, 3. capture and process the results
and
 4. disconnect before completing a single page to a web browser client (it
 will probably never do active user input, because of the nature of PHP
and
 the web server), then I would suggest you consider rexec, rcp, rsh
or
 if what you want is in a file on the host machine, you could use the ftp
 functions.  These are not telnet, and do require special deamons running
on
 the host machine, but may do the trick.

 I have been looking for your telnet client for a long time as well, and if
 you find one, please remember

RE: [PHP] Telnet and PHP

2001-06-30 Thread Warren Vail

By active user input, I would assume that you mean every time the user
makes a keystroke, the keystroke is sent to the host machine.  This is not a
characteristic of html which only sends information to the host machine when
some form of submit is clicked.  The advantage of the applet for this sort
of thing is it runs on the browser client, and has the capability of sending
every keystroke directly to the host, bypassing the server side.

On the server side, once the (PHP) application is done sending the requested
files to the web browser for one user, it moves on to handling the requests
for other users.  Can you imagine the load on a server if it had to reload
your application every time, your user pressed a key.

You never really made it clear where you expected this client to run,
although PHP, at this point, can only run on the server.  Now if you are
looking for something that your PHP code could use to 1. signon to a host
somewhere, 2. execute some commands, 3. capture and process the results and
4. disconnect before completing a single page to a web browser client (it
will probably never do active user input, because of the nature of PHP and
the web server), then I would suggest you consider rexec, rcp, rsh or
if what you want is in a file on the host machine, you could use the ftp
functions.  These are not telnet, and do require special deamons running on
the host machine, but may do the trick.

I have been looking for your telnet client for a long time as well, and if
you find one, please remember to post it here, but I would suspect that one
of the problems in doing a telnet client in php is that the telnet client
needs to be multi-threaded.  Perhaps someone will someday take open source
like Dave's Telnet and fashion an extension to PHP.

Til then, try the options above,

Warren Vail


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 10:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Telnet and PHP


I was doing some research on creating a webbased telnet client and I am
unsatisfied with Java applets. I would like to create a server side telnet
client, so the user side is only required to have a working web browser that
supports HTML.

Thus, I turned to PHP. I found one example, but it does not allow for active
user input. While I will sit down this evening and work with the code, I was
wondering if anyone had/knew of a good example of a PHP telnet client.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Telnet and PHP

2001-06-30 Thread jon

Instead of performing a send for each stroke, the user code type in a whole
string in a text box, and then submit that string. I have found this code at
http://www.phpbuilder.com/mail/php-general/2001051/1479.php:

?
error_reporting(-1);


class Telnet {
/* (c) [EMAIL PROTECTED] */


var $sock = NULL;


function telnet($host,$port) {
$this-sock = fsockopen($host,$port);
socket_set_timeout($this-sock,2,0);
}


function close() {
if ($this-sock)
fclose($this-sock);
$this-sock = NULL;
}


function write($buffer) {
$buffer = str_replace(chr(255),chr(255).chr(255),$buffer);
fwrite($this-sock,$buffer);
}


function getc() {
return fgetc($this-sock);
}


function read_till($what) {
$buf = '';
while (1) {
$IAC = chr(255);


$DONT = chr(254);
$DO = chr(253);


$WONT = chr(252);
$WILL = chr(251);


$theNULL = chr(0);


$c = $this-getc();


if ($c === false)
  return $buf;


if ($c == $theNULL) {
continue;
}


if ($c == \021) {
continue;
}


if ($c != $IAC) {
$buf .= $c;


if ($what ==
(substr($buf,strlen($buf)-strlen($what {
return $buf;
} else {
continue;
}
}


$c = $this-getc();


if ($c == $IAC) {
$buf .= $c;
} else if (($c == $DO) || ($c == $DONT)) {
$opt = $this-getc();
// echo we wont .ord($opt).\n;
fwrite($this-sock,$IAC.$WONT.$opt);
} elseif (($c == $WILL) || ($c == $WONT)) {
$opt = $this-getc();
// echo we dont .ord($opt).\n;
fwrite($this-sock,$IAC.$DONT.$opt);
} else {
// echo where are we? c=.ord($c).\n;
}
}


}
}


$tn = new telnet(192.168.255.100,23);
echo $tn-read_till(ogin: );
$tn-write(admin\r\n);
echo $tn-read_till(word: );
$tn-write(thieso\r\n);
echo $tn-read_till(: );
$tn-write(ps\r\n);
echo $tn-read_till(: );
echo $tn-close();
?





- Original Message -
From: Warren Vail [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, June 30, 2001 2:01 PM
Subject: RE: [PHP] Telnet and PHP


 By active user input, I would assume that you mean every time the user
 makes a keystroke, the keystroke is sent to the host machine.  This is not
a
 characteristic of html which only sends information to the host machine
when
 some form of submit is clicked.  The advantage of the applet for this sort
 of thing is it runs on the browser client, and has the capability of
sending
 every keystroke directly to the host, bypassing the server side.

 On the server side, once the (PHP) application is done sending the
requested
 files to the web browser for one user, it moves on to handling the
requests
 for other users.  Can you imagine the load on a server if it had to reload
 your application every time, your user pressed a key.

 You never really made it clear where you expected this client to run,
 although PHP, at this point, can only run on the server.  Now if you are
 looking for something that your PHP code could use to 1. signon to a host
 somewhere, 2. execute some commands, 3. capture and process the results
and
 4. disconnect before completing a single page to a web browser client (it
 will probably never do active user input, because of the nature of PHP
and
 the web server), then I would suggest you consider rexec, rcp, rsh
or
 if what you want is in a file on the host machine, you could use the ftp
 functions.  These are not telnet, and do require special deamons running
on
 the host machine, but may do the trick.

 I have been looking for your telnet client for a long time as well, and if
 you find one, please remember to post it here, but I would suspect that
one
 of the problems in doing a telnet client in php is that the telnet client
 needs to be multi-threaded.  Perhaps someone will someday take open source
 like Dave's Telnet and fashion an extension to PHP.

 Til then, try the options above,

 Warren Vail


 -Original Message-
 From: [EMAIL PROTECTED] [mailto

Re: [PHP] Telnet with php?

2001-02-09 Thread Julia A . Case

I've been messing with popen and telnet recently and I can see the machine connect 
and show a response but I never get to a login prompt.  I'll be fiddling with this 
some more, maybe we can work on it together?

Julia

Quoting Brandon Orther ([EMAIL PROTECTED]):
 Hello,
 
 Is there a way to telnet with php?  If so does anyone know a good place to
 find a tutorial on it?
 
 Thank you,
 
 
 Brandon Orther
 WebIntellects Design/Development Manager
 [EMAIL PROTECTED]
 800-994-6364
 www.webintellects.com
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
[  Julia Anne Case  ] [Ships are safe inside the harbor,   ]
[Programmer at large] [  but is that what ships are really for.]  
[   Admining Linux  ] [   To thine own self be true.   ]
[ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]
  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Telnet with php?

2001-02-09 Thread Matt Friedman

there's fsockopen from which you might make a telnet client, methinks, but
you'd have to know the protocol etc...

look for it at the manual.

Matt Friedman
Spry New Media
http://www.sprynewmedia.com
Lead Programmer/Partner
email: [EMAIL PROTECTED]
phone: 250 744 3655
fax: 250 370 0436


- Original Message -
From: "Brandon Orther" [EMAIL PROTECTED]
To: "PHP User Group" [EMAIL PROTECTED]
Sent: Friday, February 09, 2001 2:12 PM
Subject: [PHP] Telnet with php?


 Hello,

 Is there a way to telnet with php?  If so does anyone know a good place to
 find a tutorial on it?

 Thank you,

 
 Brandon Orther
 WebIntellects Design/Development Manager
 [EMAIL PROTECTED]
 800-994-6364
 www.webintellects.com
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Telnet with php?

2001-02-09 Thread Jeff Lacy

If you are just looking for something better than the ms telnet program,
look at http://www.chiark.greenend.org.uk/~sgtatham/putty/.  it is so much
better than telnet.  I don't know if that is what you mean, though.

Jeff



""Brandon Orther"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,

 Is there a way to telnet with php?  If so does anyone know a good place to
 find a tutorial on it?

 Thank you,

 
 Brandon Orther
 WebIntellects Design/Development Manager
 [EMAIL PROTECTED]
 800-994-6364
 www.webintellects.com
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]