PHP Classes
Icontem

File: example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of sam  >  Apache log parser  >  example.php  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of the class
Class: Apache log parser
Parse Apache log files in the common log format
 

Contents

Class file image Download
<?php
/*
+----------------------------------------------+
|                                              |
|      PHP example apache log parser class     |
|                                              |
+----------------------------------------------+
| Filename   : example.php                     |
| Created    : 21-Sep-05 23:28 GMT             |
| Created By : Sam Clarke                      |
| Email      : admin@free-webmaster-help.com   |
| Version    : 1.0                             |
|                                              |
+----------------------------------------------+


LICENSE

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

To read the license please visit http://www.gnu.org/copyleft/gpl.html

*/

include 'apache-log-parser.php';

$apache_log_parser = new apache_log_parser(); // Create an apache log parser

if ($apache_log_parser->open_log_file('example.log')) // Make sure it opens the log file
{
  while (
$line $apache_log_parser->get_line()) { // while it can get a line
    
$parsed_line $apache_log_parser->format_line($line); // format the line
    
print_r($parsed_line); // print out the array
  
}
  
$apache_log_parser->close_log_file(); // close the log file
}
else
{
  echo 
'Sorry cannot open log file.';
}
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products