Re: Standard Input?
| From: | Michael: Dave II, Electric Boogaloo | Date: | Tue, 25 Jun 2002 01:21:00 +0000 |
| Subject: | Re: Standard Input? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103709@lists.php.net to get a copy of this message | ||
"Analysis & Solutions" <danielc@analysisandsolutions.com> wrote in message
> On Mon, Jun 24, 2002 at 02:07:28PM -0700, Michael wrote:
> > Are there functions in PHP that will allow me to read in a variable via
> > standard input? I just wanted to do something like this:
>
> http://www.php.net/manual/en/function.fopen.php
Perfect! Thank you!
Anyway, for anyone else who's interested in the answer and doesn't want to
dig through the user contributed notes for fopen....
function read($length='255'){
if (!isset($GLOBALS['StdinPointer'])){
$GLOBALS['StdinPointer']=fopen("php://stdin","r");
}
$line=fgets($GLOBALS['StdinPointer'],$length);
return trim($line);
}
Michael