Re: Help With passthru, system, exec

From: Date: Mon, 22 Jan 2001 02:16:31 +0000
Subject: Re: Help With passthru, system, exec
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35936@lists.php.net to get a copy of this message
> I've been trying to write something to ping a URL on the system level, and > keep the output in an array. I've been trying to work with system, exec, > and passthru, but it looks as though they all return only the last line of > the output. How would I put the whole output into the array? A different They all *return* the last line, but exec (and some others) accept an array they can "fill up" with the data you want. <?php $cmd = "ping $IP -c 1"; exec($cmd, $results, $error); while (list(,$line) = each($results)){ echo $line, "<BR>\n"; } if ($error){ echo "OS Error $error. Usually path/permissions."; } ?>

« previous php.general (#35936) next »