You will need to use a regular expression to extract the IP address and port from that line. I am not very good with them so either you will have to find out how to do it or someone else on the forum might be able to help you.
I do know that you need to use preg_match to use the regular expression. I'll post back if I find anything else helpful.
Edit:
Ok, after a little fooling around I found something that might help you:
Code: Select all
<?php
preg_match_all("/\d+\.\d+\.\d+\.\d+\s\d+/",
"LAN k0nsl 127.0.0.1 9035 Monday 12, 07:32:47 Win2000", $matches);
?>
<pre>
<?php print_r($matches) ?>
</pre>
Will output:
Code: Select all
Array
(
ї0] => Array
(
ї0] => 127.0.0.1 9035
)
)
Then just use str_replace to replace the whitespace with a colon.
So the final code would be something like this:
Code: Select all
<?php
preg_match_all("/\d+\.\d+\.\d+\.\d+\s\d+/",
"LAN k0nsl 127.0.0.1 9035 Monday 12, 07:32:47 Win2000", $matches);
$ip = str_replace(":", " ", $matches[0][0]);
echo $ip; //echos 127.0.0.1:9035
?>