I don't remember the exact terms, but telnet won't work unless it's
connected to a tty (ie, you're running it from a command prompt).  That's
why it works when you run it with the PHP binary.

If you're intent on using this method, there's a couple of programs to
look at: socket, and netcat.

Although I'd just do this in PHP itself using the fsockopen() function
(see the man page for an example).

On Tue, 24 Jul 2001, Ben Bleything wrote:

> Hey all... I tried sending this earlier... accidentally sent it to
> [EMAIL PROTECTED], then tried bouncing it to the write address...
> anyway, apologies if it didn't work correctly.
>
> Anyhoo...
>
> I'm trying to get a piece of information from a server in the field that
> responds to a certain command with a line of data... ie 'telnet machine
> temp' and it gives back "MACHINE:75.3" (temperature).
>
> Anyway, there's a bunch of other stuff you can do to it with rsh, but
> that's not directly important.  I'm trying to build a web interface to
> control these machines.  Basically, I need to have PHP call 'telnet
> machine temp' and have it feed out whatever the machine returns...
>
> I've tried exec(), system(), passthru(), and backticks, all without
> success.  I imagine that the reason for this is that telnet isn't routing
> it's stuff to STDOUT (or whatever it is that php reads from in this
> situation).
>
> Now, get this.  If I use my php binary (shell scripting with php!  wh00!)
> it works dandy... the temp gets passed on, yadda yadda yippy.  But the
> second you try from a web browser, no dice.
>
> Now, I may be completely off track here... it may be that for some reason
> that I don't understand, telnet isn't actually outputting anything... I
> suspect it is, though.
>
> So... any ideas how I can get what I want?
>
> Thanks,
> Ben
>
>
> --
> 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]

Reply via email to