On 13 Mar, 12:20, Janwillem Borleffs <j...@jwscripts.comwrote:
Quote:
Originally Posted by
lbvox schreef:Hello, I have created this script, but I do not succeed toinsert the
Quote:
Originally Posted by
function "explode ()" for being able to gain given following dates
---- ($host="hostname" / $msg="msg" /$date="date")
|
>
[...]
>
Quote:
Originally Posted by
* *// registry in the variable $buffer the content of the line
* *$buffer=fgets($identificatore, 4096);
|
>
Insert the following below this line:
>
list($hostname, $msg, $date) = explode('|', $buffer);
>
JW
|
I have followed as you have indicated to me
<?php
// apro il file in lettura
$identificatore=fopen ("test.txt", "r");
// testo da trovare all'interno del file
$host="hostname";
$msg="msg";
$date="date";
$risultato="$host|$msg|$date";
$counter=0;
// eseguo il ciclo fino alla fine del file
while (!feof ($identificatore)){
// incremento il $counter di una unità
$counter ++;
// registro nella variabile $buffer il contenuto della linea
$buffer=fgets($identificatore, 4096);
list($hostname, $msg, $date) = explode('|', $buffer);
// controllo con eregi se all'interno di $buffer c'è il testo che sto
cercando
// se l'esito è positivo stampo a video il suo contenuto
if (ereg($risultato, $buffer))
echo "$date<br>";
echo "$hostname<br>";
echo "$date<br>";
}
// chiudo il file
//fclose ($identificatore);
But Now the output it does not work
the output show all file