In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> > Working kind of :)
> >
> > Get one line from it....
> 
> Kinda... I get it to return one line...
> 
> The code:
> 
> <?php
> define('STDIN',fopen("php://stdin","r"));
> $str = fgets(STDIN);
> mail("[EMAIL PROTECTED]","Test","Test Test...\n\nOriginal
> Email:\n\n$str");
> ?>
> 
> Emails me:
> 
> Test Test...
> 
> Original Email:
> 
> >From [EMAIL PROTECTED] Thu Jun 12 11:41:39 2003

>From the docs (fgets):

"Returns a string of up to length - 1 bytes read from the file pointed to 
by fp. Reading ends when length - 1 bytes have been read, on a newline 
(which is included in the return value), or on EOF (whichever comes 
first). If no length is specified, the length defaults to 1k, or 1024 
bytes." 

So it's reading up to the first newline, as expected :-) Modify the 
example from the manual to suit your needs:

$fd = fopen ("/tmp/inputfile.txt", "r"); 
while (!feof ($fd)) { 
   $buffer = fgets($fd, 4096); 
   echo $buffer; 
} 
fclose ($fd); 

Cheers
-- 
Quod subigo farinam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to