Re: Getting the Output from System Commands in WINNT
| From: | rouvas at kos dot mm dot di dot uoa dot gr | Date: | Sat, 04 Nov 2000 21:18:58 +0000 |
| Subject: | Re: Getting the Output from System Commands in WINNT | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3686@lists.php.net to get a copy of this message | ||
Example of a dir /b/s command in NT (I just want the filenames):
$tfp = popen('dir '.$lv[$logdir].' /b/s',"r");
while (!feof($tfp)) {
$t = explode("\n",fgets($tfp,40960)); $t[0] = trim($t[0]);
if (strlen($t[0]) != 0 )$tfpar[] = $t[0];
}
pclose($tfp);
On Sat, 4 Nov 2000, Shane Almeida wrote:
> I've determined that finger is actually being invoked, it shows up as a
> process momentarily as the page is loading. It seems that my problem is in
> the way I am trying to get the output. Any suggestions? See below for the
> approaches I have tried...
>
> >>>>>>>>>>>>>>>>>>
>
> > Is there a way to execute system commands in
> > WINNT using PHP? I'm trying to get the output
> > of finger.exe to show up on my webpage but so
> > far nothing is working. I've tried this:
> >
> > <?
> > $finger = "finger someone@somewhere";
> > system($finger);
> > ?>
> >
> > and
> >
> > <?
> > $finger = "finger someone@somewhere";
> > passthru($finger);
> > ?>
> >
> > and
> >
> > <?
> > $finger = "finger someone@somewhere";
> > exec($finger);
> > ?>
> >
> > and nothing works. I've also tried giving the
> > path to finger in different ways:
> > C:\WINNT\System32\finger.exe and
> > \WINNT\System32\finger.exe. I made a copy of
> > finger.exe and put it in my web directory and
> > still no luck. Any ideas?
>
>