Re: formatting "host" output
| From: | David Robley | Date: | Mon, 23 Jul 2001 04:47:13 +0000 |
| Subject: | Re: formatting "host" output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59120@lists.php.net to get a copy of this message | ||
On Sat, 21 Jul 2001 06:32, Tyler Longren wrote:
> $data = exec("host $lookup");
> printf("<pre>%s</pre>", $data);
>
> How can I format the output of that properly?
> Sometimes, it's all on one line, and it's fine.
> Other times, there's more than one line...like if there was an alias.
>
> Any way to format it like it is on the command line?
>
> Thanks,
> Tyler
$data = exec("host $lookup", $ary);
while(list(,$val) = each($ary)) {
echo $val . '<BR>';
}
You need to assign the output of exec to an array if you want to capture
multiple lines of output. Check the manual for more detail.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Try our NEW *SOLAR POWERED* tanning salon!