Re: PHP Linux "locate" to html script?
| From: | lonewolf at nc dot rr dot com | Date: | Fri, 03 Sep 2004 19:30:06 +0000 |
| Subject: | Re: PHP Linux "locate" to html script? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-195771@lists.php.net to get a copy of this message | ||
Aww, I answered this one already too... I thought I beat everyone in as well, but maybe the list
is still slow??
Passthru() is better then exec() in this case, since he wants everything from locate, I
couldn't get the explode to work on my system because it didn't catch the "\n"
character very well, or I messed up in the code somewhere.
What would the explode look like for this:
<?php
$item = passthru('locate whatever');
$items = explode("\n",$item);
echo "<html><body><P>";
echo $items[0];
echo "</P></body></html>";
?>
----- Original Message -----
From: Ben Ramsey <lists@benramsey.com>
Date: Friday, September 3, 2004 2:44 pm
Subject: Re: [PHP] PHP Linux "locate" to html script?
> According to the manual, exec() "does not output anything. It
> simply
> returns the last line from the result of the command." The OP
> wants to
> display the output of 'locate' to the browser, so he should use
> passthru(), which displays all raw output.
>
> Jay Blanchard wrote:
> > [snip]
> > Does anyone have a script that can be used to call linux's locate
> > command
> > and display the results in a browser?
> >
> > I don't think it would be that hard and will make an effort today...
> > [/snip]
> >
> > exec("locate foo");
>
> --
> Regards,
> Ben Ramsey
> http://benramsey.com
>
> ---------------------------------------------------
> http://www.phpcommunity.org/
> Open Source, Open Community
> Visit for more information or to join the movement.
> ---------------------------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>