473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Keyboard input using command line PHP under Windows

I can't get any of the various examples of keyboard input to work
using command line PHP.

I have Windows XP Pro SP 2 and PHP 5.1.6 (cli) (built: Aug 23 2006
16:35:53).

I can't find any info about why it doesn't work, or a way that does
work. Any suggestions?

examples of attempted variations: (and I've tried others)

$psLine = fgets (STDIN, 1024); // phpa.php at http://david.acz.org/phpa/

stdin = fopen("php://stdin", "r"); // PHP_Shell-0.3.1
$l = fgets(stdin);
Jan 20 '08 #1
2 11302
BDthatsme wrote:
I can't get any of the various examples of keyboard input to work
using command line PHP.

I have Windows XP Pro SP 2 and PHP 5.1.6 (cli) (built: Aug 23 2006
16:35:53).

I can't find any info about why it doesn't work, or a way that does
work. Any suggestions?

examples of attempted variations: (and I've tried others)

$psLine = fgets (STDIN, 1024); // phpa.php at http://david.acz.org/phpa/

stdin = fopen("php://stdin", "r"); // PHP_Shell-0.3.1
$l = fgets(stdin);
Under Windows you have to hit <ENTERto complete the input. Windows
does not support character by character entry/processing without
installing ncurses. Even then i'm not positive but I think so. Thing is
you'll have to compile it yourself. I have found it works out of the box
under Linux but have not done much testing.

--
Norman
Registered Linux user #461062
Jan 21 '08 #2
On Sun, 20 Jan 2008 14:26:41 -0800 (PST), BDthatsme
<bd********@donnelly-house.netwrote:
>I can't get any of the various examples of keyboard input to work
using command line PHP.

I have Windows XP Pro SP 2 and PHP 5.1.6 (cli) (built: Aug 23 2006
16:35:53).

I can't find any info about why it doesn't work, or a way that does
work. Any suggestions?

examples of attempted variations: (and I've tried others)

$psLine = fgets (STDIN, 1024); // phpa.php at http://david.acz.org/phpa/

stdin = fopen("php://stdin", "r"); // PHP_Shell-0.3.1
$l = fgets(stdin);
PHP variables must be prepended with a '$'. So change 'stdin' to
'$stdin' (in both places) and your last variation should work.

Daniel Klein
Jan 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christian Long | last post by:
Hi I'm trying to pipe data into a python program on Windows 2000, on the command line. Like this: dir | myProgram.py Here's what I tried:
7
by: k8 | last post by:
Hello- I'm stuck on a Windows machine today and would love to fully play with and test a simple python script. I want to be able to type "python myscript myarg" somewhere. Is there anything...
2
by: mei xiao | last post by:
Hi, there, I have a small web service project written in C# and compiled using visual studio.net, but how can I compile it using command line? Thank you. -May
2
by: accessjunior | last post by:
I was wondering if there is any way to close Access using command line swithes? Currently I have a batch file that calls the .mdb runs a macro and compacts, then I would like to close it. Any...
5
abdoelmasry
by: abdoelmasry | last post by:
Hey could any one tell me is there away to end any proccess using command line ?? i can get all running proccesses using command (tasklist) ThX
0
by: Siebbel | last post by:
Hello, I would like to install DB2 on a remote linux computer using command line. Does anybody know if that is possible? Or if not, are there possibilities to have the graphical interface on my...
1
by: BDthatsme | last post by:
I have tried various ways to get input from the keyboard using the CLI version of PHP on Windows XP SP2, and none of them seem to work. And I can't find any info about it anywhere. (as in how or...
1
by: 85ssp | last post by:
I am working on debugging a multithreaded network application. I have two forms. One of which is my testing form, the other is the actual user form. I need to be able to load only my testing form...
0
by: Garima12 | last post by:
Can I downgrade dbase 7 to dbase 4 file using command line?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.