Connecting Tech Pros Worldwide Forums | Help | Site Map

reading keyboard and interaction with os

Yandos
Guest
 
Posts: n/a
#1: Nov 22 '05
Hello php gurus,

maybe it sounds crazy, but I'd would like to use php for some system
administration, backups, etc, but sometimes user interaction is needed.
Till now i have been using windows script host, but more and more I need
communication with intranet servers, which works fine with libcurl. Now
I'm executing curl.exe for every intranet request I need, and it's too slow.

My question is, if I can read keyboard using php. I know i can execute
external program like choice.com (to ask for answer no/yes etc), but
this is the thing i'd like to avoid... I know there's ton of other
languges which could do that better, jike java or c++, but php is the
only I know a bit.

Thank you for any ideas,
Y.

NC
Guest
 
Posts: n/a
#2: Nov 22 '05

re: reading keyboard and interaction with os


Yandos wrote:[color=blue]
>
> My question is, if I can read keyboard using php.[/color]

If you are running a command-line interpreter, yes; you can read
keyboard input from standard input stream (STDIN):

$response = trim(fgets(STDIN));

Cheers,
NC

Yandos
Guest
 
Posts: n/a
#3: Nov 22 '05

re: reading keyboard and interaction with os


"NC" <nc@iname.com> wrote in news:1132335121.905963.215850
@f14g2000cwb.googlegroups.com:
[color=blue]
> Yandos wrote:[color=green]
>>
>> My question is, if I can read keyboard using php.[/color]
>
> If you are running a command-line interpreter, yes; you can read
> keyboard input from standard input stream (STDIN):
>
> $response = trim(fgets(STDIN));
>
> Cheers,
> NC
>
>[/color]

That's great, thank you :)

Y.
Closed Thread