get_fqdn_tmg1.php 459 B

12345678910111213141516171819202122232425
  1. <?php
  2. //License: WTFPL
  3. define('F_INPUT','noncloudflarelist.txt');
  4. define('F_OUTPUT','fqdnlist.txt');
  5. if (!file_exists(F_INPUT)){
  6. print 'File not found';
  7. exit;
  8. }
  9. $result = array();
  10. foreach(explode("\n",file_get_contents(F_INPUT)) as $t){
  11. $t = explode(' ',$t)[0];
  12. if (preg_match("/^([a-z0-9\.-]{1,255})\.([a-z]{2,40})$/",$t)){
  13. $result[] = $t;
  14. }
  15. }
  16. $result = array_unique($result);
  17. file_put_contents(F_OUTPUT,implode("\n",$result));
  18. print 'Done';