#!/path/to/php -q
  <?

  $fp = fopen('/dev/stdin','r');

  if($fp)
  {
    while(!feof($fp))
    {
      $line = trim(fgets($fp,4096));
    }
  }

  ?>

  chmod +x script.php


--Joe

On Fri, Feb 02, 2001 at 04:36:48PM -0300, Martin A. Marques wrote:
> I want to use PHP to build a script that would run from the comand line. Now 
> me problem is how do I make PHP interpretate a chunk of text that is piped to 
> it?
> Lets say my script is named script1.php and I do:
> 
> $ less file1 | script1.php
> 
> just like if I send variables with info with a put in the apache module 
> version.
> How do I get that output?
> 
> Saludos... :-)
> 
> -- 
> System Administration: It's a dirty job, 
> but someone told I had to do it.
> -----------------------------------------------------------------
> Martín Marqués                        email:  [EMAIL PROTECTED]
> Santa Fe - Argentina          http://math.unl.edu.ar/~martin/
> Administrador de sistemas en math.unl.edu.ar
> -----------------------------------------------------------------
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

-------------------------------------------------------------------------------
Joe Stump, PHP Hacker, [EMAIL PROTECTED]                                 -o)
http://www.miester.org http://www.care2.com                                 /\\
"It's not enough to succeed. Everyone else must fail" -- Larry Ellison     _\_V
-------------------------------------------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to