Re: can you prompt for variables in command-line CGI?

From: Date: Mon, 27 Aug 2001 00:16:11 +0000
Subject: Re: can you prompt for variables in command-line CGI?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64563@lists.php.net to get a copy of this message
http://www.phpbuilder.com/columns/darrell20000319.php3 gives a good explanation. #!/usr/local/bin/php -q <?php function read() { $fp=fopen("/dev/stdin", "r"); $input=fgets($fp, 255); fclose($fp); return trim($input); } print("What is your first name? "); $first_name = read(); print("What is your last name? "); $last_name = read(); print("\nHello, $first_name $last_name! Nice to meet you!\n"); ?> /* Chris Lambert, CTO - chris@whitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ ----- Original Message ----- From: Derek Sivers <php@cdbaby.com> To: <php-general@lists.php.net> Sent: Sunday, August 26, 2001 7:49 PM Subject: [PHP] can you prompt for variables in command-line CGI? | for a SHELL SCRIPT using php binary: | | in bash I would do this: | | #!/bin/bash | echo -n "username: " | read username | echo -n "password: " | read password | echo $username | echo $password | | Run on the command-line, it would stop and ask me for the username and | password, then continue the bash shell script. | | But in PHP, how would I prompt someone at the command-line for input? | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net | For additional commands, e-mail: php-general-help@lists.php.net | To contact the list administrators, e-mail: php-list-admin@lists.php.net | | |

« previous php.general (#64563) next »