Re: Where's the error?

From: Date: Tue, 14 May 2002 03:18:48 +0000
Subject: Re: Where's the error?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-97482@lists.php.net to get a copy of this message
I put 'print_r($fcontents);' in and it outputted the array of my log file so I'm not sure what's wrong. Here's a section of the log file. I'm trying to get the date of the first access and the last access. 203.29.154.13 - - [08/May/2002:21:21:22 +1000] "GET /A1.html HTTP/1.1" 304 - "-" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" 203.29.154.13 - - [09/May/2002:21:21:23 +1000] "GET /A1.html HTTP/1.1" 304 - "-" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" 203.29.154.13 - - [10/May/2002:21:21:24 +1000] "GET /A1.html HTTP/1.1" 304 - "-" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" Regards Josh "Lars Torben Wilson" <torben@php.net> wrote in message news:1021345553.886.133.camel@ali... > On Mon, 2002-05-13 at 20:01, Josh Edwards wrote: > > Thanks heaps for your help I really appreciate it. I have made the changes > > you suggested but now I only get a blank screen. > > > > function getmydate($hit) > > { > > $single = explode (" ",$hit); > > return $single[3].$single[4]; > > } > > > > $filename = ("combined_log"); > > > > //fopen ($filename, "r"); > > > > $fcontents = file($filename); > > $limit = 1; > > for ($i = 0; $i <= $limit; $i++) > > { > > $line = $fcontents[i]; > > if (!empty($line)) > > { > > $currentdate = getmydate($line); > > echo $currentdate; > > } > > } > > Things to check: > > o Put 'error_reporting(E_ALL);' as the first line of your script. > o Are you sure it's reading the file? Try 'print_r($fcontents);' after > the file() call. > > That might get you a little farther. Otherwise post a few > representative lines from combined_log; otherwise we won't > have any real data to work with. > > > -- > Torben Wilson <torben@php.net> > http://www.thebuttlesschaps.com > http://www.hybrid17.com > http://www.inflatableeye.com > +1.604.709.0506 >

« previous php.general (#97482) next »