|
Posted by Tyrone Slothrop on 02/01/06 03:56
On 31 Jan 2006 15:27:22 -0800, "Redfox05" <redfox05@gmail.com> wrote:
>Hi,
>im not sure how this is going to work but this is the aim:
>
>I need to figure out how to be able to read a file and scan it for
>certain phrases and then extract the information at a certain point.
>
>To be more specific, I want to read a file generated by webalizer, and
>extract the bit where it states the total monthly bandwidth, so I can
>display this on a site without showing all the other more detailed
>stats stuff.
>
>Is this possible? Or is my idea just way to far into fantasy world.
>But just incase it is possible, am I doing the right thing, would there
>be a way which is a lot more easier.
>
>Thanks in advance.
Nothing much to it. Use the file() function and look for your
matches. Of course, the file must have the proper permissions to be
read by PHP.
$lines = file("/path/to/report");
foreach ($lines as $line) {
if (strstr ($match, $line) {
echo $line;
}
}
Navigation:
[Reply to this message]
|