I have a log file which is a .txt file which displays
IP ADDRESS, TIME STAMP,FILENAME,HTTP STATUS CODE,BANDWIDTH,USER AGENT
1.)18.104.22.168 -- [2007-04-01 00:42:21] "GET articles/learn_PHP_basics HTTP/1.0" 200 12729 "Mozilla/4.0"
2.)22.214.171.124 -- [2007-04-01 01:24:42] "GET index.php HTTP/1.0" 200 11411 "Mozilla/4.0"
I need to findout
1. The total number of file requests in the month.
2. The number of file requests from the articles directory.
3. The TOTAL bandwidth consumed by the file requests over the month.
4. The number of requests that resulted in 404 status errors. Display a list of the filenames that produced these 404 errors (try not to repeat filenames if the same wrong filename was requested more than once
i've managed to get the total number of files
$linecount = 0;
$handle = fopen($file, "r");
$line = fgets($handle);
to get the data i know i need to explode the strings into an array and loop through the array to count the information needed but i'm struggling with exploding it properly so it breaks up the array properly