Re: I want to get the input of keyboard

From: Date: Wed, 27 Jun 2001 06:27:37 +0000
Subject: Re: I want to get the input of keyboard
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55346@lists.php.net to get a copy of this message
> I want to get the input of keyboard from php files,but i can't know how to > do. > > Who can tell me any advace about that? If you want the input from the keyboard on the web-server machine (not the client) you can use: $file = fopen('php://input', 'r'); $char = fread($file, 1); If you want keyboard input from a web browser client, you'll have to either: Use JavaScript to capture the input, and then open up another HTTP connection to a totally different PHP script to do something with it, or Create a Java applet and Java servelet to have a keep-alive connection that captures the browsers keystrokes and sends them back (via the Java servlet) to PHP. The first option will be dog-slow and completely un-usable for all but a very limited class of solutions... Keep in mind that PHP runs on the *SERVER*, and, in fact, your PHP script is completely finished, dead, and gone by the time the user types a key. If these options are unhelpful, tell us what you are actually trying to do at a higher level. Oh yeah: For purely server-side shell-scripting keyboard cool-ness, I would imagine that the new GTK-PHP combination would have some nifty stuff in it... Haven't even looked at it myself, and I don't even know GTK, so it will be awhile before I can say anything more intelligent about it... Not that that always stops me :-) -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#55346) next »