$log_files = ftp_nlist($conn_id, "./TOST*.log");
foreach($log_files as $i => $file ) {
ftp_get($conn_id, "tempfile", $file, FTP_ASCII);
$fp = fopen("tempfile","r");
$contents = fread($fp, filesize("tempfile") );
$contents = str_replace("\0","", $contents);
preg_match_all("/TOST Protect: Ident: ([^ ]*) - ([^- ]*) - ([0-9\.]*)/", $contents, $matches);
echo "<br><b>Log File $i</b>";
foreach($matches[1] as $key => $value) {
echo "\n<br>$value\t". $matches[2][$key]. "\t" .$matches[3][$key];
}
// ftp_close($conn_id);exit;
}
ftp_close($conn_id);
Should output this
Log File 1 something something2 something3
Log File 2 something4 something5 something6
etc.. until all the "./TOST*.log" in the ftp directory and outputted.
If I enter a direct file in the nlist it will output it correctly
I know the this is working ok $log_files = ftp_nlist($conn_id, "./TOST*.log");
because when I echo $file the contents are displayed in each incremented Log File. However, this script is only outputting this
Log File 1
Log File 2
Log File 3
when I use this
ftp_nlist($conn_id, "./TOST*.log");
The filenames on the server go as follows
TOST.ServerFile-eachdateisdifferant.log
any help?