Re: howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

From: Date: Fri, 04 May 2012 15:51:05 +0000
Subject: Re: howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-317786@lists.php.net to get a copy of this message
On 4 May 2012, at 15:48, Andres Gonzalez wrote: > I am trying to code a CLI PHP script that will give me the keycodes for these (and other) > keyboard keys. I want to basically block until the user presses a single key, then I want to process > that event without the user having to press the Enter key after pressing a single key. > > I have tried several approaches but with no success. Using fopen() to open stdin, and fgetc() > will give me the regular keys but requires the user to press the Enter key after the initial key is > pressed. When I press the the PgDw key for example, those routines return a single character string > even though the stty echos a 5 character string (using PgDw echos "^[[6~") > > I have tried other approaches using bash read commands to get a single character but will > little success also. > > Anybody here know how to do this? As far as I know you can't do this through any of the built-in functions. However, the ncurses extension may give you what you need: http://php.net/ncurses -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/

« previous php.general (#317786) next »