
06.12.2008, 00:12
|
|
Участник форума
Регистрация: 24.11.2008
Сообщений: 205
Провел на форуме: 1123418
Репутация:
362
|
|
странные отчеты.. ммм...
PHP код:
<?php
$text = '94.21.65.1 62 ms 1.65.xxline.net 80
94.21.65.9 62 ms 9.65.xxline.net 80
94.21.65.10 62 ms 10.65.xxline.net 80
94.21.65.18 61 ms 18.65.xxline.net 80
94.21.65.17 76 ms ns1.teleru.net 80
94.21.65.33 69 ms 33.65.xxline.net 80
94.21.66.29 46 ms tps.ruschoc.ru 80
94.21.66.85 46 ms 95.66.xxline.net 80
94.21.66.86 54 ms 96.66.xxline.net 80
94.21.66.140 46 ms mail.imgcis.com 80
94.21.66.153 46 ms 153.66.xxline.net 80
94.21.66.154 46 ms 154.66.xxline.net 80
94.21.66.178 46 ms 178.66.xxline.net 80
94.21.66.182 46 ms 182.66.xxline.net 80
94.21.66.186 46 ms 186.66.xxline.net 80
94.21.66.190 46 ms 190.66.xxline.net 80
94.21.66.213 46 ms 213.66.xxline.net 80
94.21.67.2 46 ms 2.67.xxline.net 80,8080
94.21.67.17 60 ms 17.67.xxline.net 80
95.198.85.169 89 ms sibprodmontazh-gw-r5-p1-280.ekb.unitline.ru80
95.198.85.145 110 ms gubkina-87-gw-r1-p5-330.ekb.unitline.ru80
95.198.85.157 107 ms alpinistov-77-1-gw-r1-p5-25.ekb.unitline.ru80
95.198.85.213 73 ms N/A 80
95.198.85.165 105 ms alpinistov-77-1-gw-r1-p5-25.ekb.unitline.ru80';
//$list = file('ip.txt');// можно так
$list = explode("\r\n",$text);
$c = count($list);
for($i=0;$i<$c;$i++) {
preg_match('#^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).+([\d,]{2,})$#U', trim($list[$i]), $out);
if(strpos($out[2],',')!==false) {
$ports=explode(',',$out[2]);
$c2=count($ports);
for($j=0;$j<$c2;$j++)
echo $out[1].':'.$ports[$j].'<br/>';
}
else echo $out[1].':'.$out[2].'<br/>';
}
?>
пробелы в регулярке постирать
|
|
|