I have been trying for days to get this to work but obviously PHP's filesystem is not one of my fortes.
The large text file I want to 'search' is the website's access log file which is quite huge.
So far I have tried:
Up to this point, I am already stuck; with even 1 day's worth of logs, this piece of code will time-out.
If you run the Apache Web Server on your win32 PC, you can find the access log (and view the sample data) file usually at:
unless, you've changed this path in httpd.conf....
The large text file I want to 'search' is the website's access log file which is quite huge.
So far I have tried:
Code:
<?php
// I hope to isolate all instances of visits by search engine spiders
// for example: googlebot / zyborg / slurp / etc
$fd = fopen( 'access.log', 'r' );
while( !feof($fd) )
{
$buffer = fgets( $fd, 4096 );
if( strstr(strtolower($buffer), 'googlebot') )
{
echo $buffer."<br />\n";
}
}
fclose ($fd);
?>
Up to this point, I am already stuck; with even 1 day's worth of logs, this piece of code will time-out.
If you run the Apache Web Server on your win32 PC, you can find the access log (and view the sample data) file usually at:
Code:
c:\program files\apache group\apache\logs\access.log
unless, you've changed this path in httpd.conf....