error_reporting(E_ALL);
class getLog {
private $wholeLog = array();
private $secondaryWholeLog = array();
public function __construct($url) {
$fp = fopen($url,"rb");
$file = stream_get_contents($fp);
fclose($fp);
$regex = "/^#(.*)$/";
$rep = "";
echo ereg_replace($regex,$rep,$file);
/* $this->wholeLog = $this->cleanLog(file($url)); // pega o arquivo de log e o limpa
echo '' .count($this->wholeLog). ' total conectados.
';
for($i = 0; $i < count($this->wholeLog); $i++) {
$this->secondaryWholeLog[$i] = explode(" ",$this->wholeLog[$i]);
// $countSecondaryWholeLog = count($this->secondaryWholeLog);
*/
}
// print_r($this->secondaryWholeLog);
//}
public function showUsers() {
foreach($this->secondaryWholeLog as $key => $value) {
echo 'usuário numero: ' . $key;
echo '
';
echo $key . ' => ' . $value;
}
}
public function cleanLog($logFileArray) {
for($i = 0; $i <= 9; $i++) { //workaround temporario pra limpar campos desnecessarios
unset($logFileArray[$i]);
}
return $logFileArray;
}
}
$a = new getLog("http://floripa.sistemaplug.com/WMSMonitor/logtest.txt");
?>