Re: fortune script.
| From: | Folke Ashberg | Date: | Fri, 24 Nov 2000 18:14:56 +0000 |
| Subject: | Re: fortune script. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26988@lists.php.net to get a copy of this message | ||
Try:
<?php
$runext = exec("/usr/bin/fortune -s", $output, $error);
while (list(,$line)=each($output)) $run.=$line."\n";
print "$run";
?>
regards
Folke
On Fri, 24 Nov 2000, Kurth Bemis wrote:
> i've written a quick script to call the program /usr/games/fortune and
> display the result on a page....the code that i'm using is below....
>
> <?php
>
> $runext = exec("/usr/games/fortune -s", $output, $error);
>
> list(,$run) = each($output);
> print "$run\n";
>
> ?>
>
> the only problem i have is that if a fortune is picked that has two lines
> it drops the second line. any ideas?
>
> see it in action at http://www.usaexpress.net/fortune.php
>
> ~kurth
> Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone Computer
>
> Passwords are like underwear. You don't share them, you don't hang them on
> your monitor, or under your keyboard, you don't email them, or put them on
> a web site, and you must change them very often. --Seen in sig.
>
> kurth@usaexpress.net | http://www.usaexpress.net/kurth
> PGP key available - http://www.usaexpress.net/kurth/pgp
>
> Fight Weak Encryption! Donate your wasted CPU cycles to Distributed.net
> (http://www.distributed.net)
>
>
>