Re: Log file details required !! Help
| From: | Marek Kilimajer | Date: | Mon, 17 Mar 2003 12:06:50 +0000 |
| Subject: | Re: Log file details required !! Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139932@lists.php.net to get a copy of this message | ||
Monil Chheda wrote:
Am I MISSING SOMETHING ????? <?php $flag = "false"; if ($fp = fopen("web.log","r")) { while (!feof($fp)) { $line = fgets($fp,1024); Here you check if there is an end of string $line, sure there is, there are no infinite strings
if (ereg("\$",$line)) {$flag="false"; } if ($flag=="true") {$linearray = explode(" ",$line); $ip = $linearray[0]; $date = $linearray[1]; $keywords = $linearray[2];echo "$ip $date $keyowrds"; }And here you check if the string has a begining, and you guess it, it does
if (ereg("\^",$line)) { $flag = "true";}} } else { echo "Could not open file";} ?> Take a closer look at regular exprations, this is the way to go
Could any one please help me Thanks... -Monil Chheda