HomePage :: TechnicalProjects :: FortuneUsingPHP
Fortune Using PHP
It isn't much, but I wrote a PHP script that echoes sayings from fortune, which I've put up on my site.
?php # This script is licensed under the GPL, and was written in summer 2003 by: # Joey Kelly, http://joeykelly.net # # Here we are trying to echo a fortune to the user exec(/usr/bin/fortune $filepath/fortune.tmp, $fortune, $returnvalue); # # general format for reading files $handle = fopen ($filepath/fortune.tmp,r); while (!feof ($handle)) $fortune = fgets($handle, 4096); echo $fortune; echobr; fclose ($handle); # ?
Then you would call it in a php webpage this way:
?php $filepath = '/path/to/files'; include($filepath/fortune.inc); ?