|
Posted by Janwillem Borleffs on 10/07/07 21:20
> I can do system or exec("change-settings"); ok, but how do I 'enter'
> the input from a php-script? The new-settings1 and 2 will be stored
> in variables in PHP.
>
Two possibilities:
#1:
<?php
$buf = '';
$fp = fopen('php://stdin', 'r');
while (!feof($fp)) {
$buf .= fgets($fp, 1024);
}
print "You wrote: $buf";
?>
(when finished, exit with CRTL+Z+<ENTER>)
#2
<?php
$buf = '';
$fp = fopen('php://stdin', 'r');
while (trim(($line = fgets($fp, 1024)))) {
$buf .= $line;
}
print "You wrote: $buf";
?>
(when finished, just hot <ENTER> twice)
HTH;
JW
Navigation:
[Reply to this message]
|