Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- TITLE OpenVPN 2.3.6 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Dec 2 2014
- TIME Wed May 25 15:05:08 2016 1464199508
- HEADER CLIENT_LIST Common Name Real Address Virtual Address Bytes Received Bytes Sent Connected Since Connected Since (time_t) Username
- CLIENT_LIST orion-01889596000195 177.43.212.110:28763 172.16.191.145 872199 860412 Wed May 25 07:22:52 2016 1464171772 UNDEF
- CLIENT_LIST elgin-05997632000195 189.10.58.244:62588 172.16.6.210 301365 250459 Wed May 25 07:01:37 2016 1464170497 UNDEF
- CLIENT_LIST databits-13031005000123 187.17.235.203:50515 172.16.136.217 459833 409771 Wed May 25 06:09:01 2016 1464167341 UNDEF
- CLIENT_LIST UNDEF 201.14.8.164:1134 42 54 Wed May 25 15:05:07 2016 1464199507 UNDEF
- CLIENT_LIST elgin-15259334000151 187.5.4.138:56256 172.16.19.10 172756 170025 Wed May 25 08:26:39 2016 1464175599 UNDEF
- CLIENT_LIST open-14297962000169 189.27.214.176:53266 172.16.191.73 339724 293760 Wed May 25 08:56:44 2016 1464177404 UNDEF
- CLIENT_LIST proficio-13441178000110 179.213.177.117:49751 172.16.196.93 1083595 945154 Tue May 24 21:36:21 2016 1464136581 UNDEF
- CLIENT_LIST ne-10404496000201-pdv2 177.96.93.80:55161 172.16.9.82 188704 187305 Wed May 25 07:57:48 2016 1464173868 UNDEF
- CLIENT_LIST suprimate-01075580000149 187.45.79.185:1031 172.16.203.133 529298 521955 Wed May 25 06:30:38 2016 1464168638 UNDEF
- CLIENT_LIST centersystem-08926273000173 177.7.217.96:30721 172.16.134.165 1208231 1049827 Tue May 24 14:37:04 2016 1464111424 UNDEF
- CLIENT_LIST sonaglio-04991306000108 179.211.242.240:63653 172.16.7.174 413439 363969 Wed May 25 07:57:25 2016 1464173845 UNDEF
- CLIENT_LIST nd-09815412000154 186.208.216.77:58423 172.16.186.249 248929 204482 Wed May 25 08:48:55 2016 1464176935 UNDEF
- CLIENT_LIST xpert-08965723000137 179.236.106.107:60047 172.16.209.97 2704576 2334226 Mon May 23 13:59:23 2016 1464022763 UNDEF
- CLIENT_LIST klotz-03626094001330 168.0.4.24:27007 172.16.183.97 681730 486133 Wed May 25 06:30:52 2016 1464168652 UNDEF
- */
- // Meu código, onde log.txt é um arquivo que contém 2000 linhas no mesmo modelo das acima
- // E essa imagem é o resultado que estou obtendo: https://snag.gy/56RBhX.jpg
- $log = "log.txt";
- $handle = fopen("$log", "r");
- $inclients = false;
- $cdata = array();
- while (!feof($handle))
- {
- $line = fgets($handle, 4096);
- if (substr($line, 0, 11) == "CLIENT_LIST")
- {
- $inclients = true;
- }
- if ($inclients)
- {
- preg_match("/CLIENT_LIST(.*)UNDEF/", $line, $conteudo);
- $partes = preg_split("/\s{2,}/", trim($conteudo[1]));
- echo var_dump($partes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment