summaryrefslogtreecommitdiffstats
path: root/tool/get_fqdn_tmg1.php
blob: 04e65b574f1c7c28cba80ed16c4157dbde11a52e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
//License: WTFPL

define('F_INPUT','noncloudflarelist.txt');
define('F_OUTPUT','fqdnlist.txt');

if (!file_exists(F_INPUT)){
	die('File not found');
}

$result = array();

foreach(explode("\n",file_get_contents(F_INPUT)) as $t){
	$t = explode(' ',$t)[0];
	if (preg_match("/^([a-z0-9-\.]{1,255})\.([a-z]{2,40})$/",$t)){
		$result[] = $t;
	}
}

$result = array_unique($result);
file_put_contents(F_OUTPUT,implode("\n",$result));

echo('Done');