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];
}
Outputs
ProbtheBestEver NERBO6V7RDMG7G:to23412131015 67.176.232.30
I am trying to seperate these next 3 things and assign each one so that I can insert in sql
ProbtheBestEver
NERBO6V7RDMG7G:to23412131015
67.176.232.30
I have been trying to do it by the whitespaces in between but have had no luck. Any help?
Cheers 🙂