Reputation: 12508
I have a file abc.txt
with contents like:
hello
hi
good
bad
...
....
Now, How to redirect the contents of the file line by line to a php script's standard input, so that when the php script is executed, it can collect the inputs by any of these commands:
$f = fopen('php://stdin', 'r');
$line = fgets($f);
or
$f = fgets(STDIN);
Upvotes: 4
Views: 2375