Skip to content

Instantly share code, notes, and snippets.

@spinsch
Created November 22, 2017 14:35
Show Gist options
  • Save spinsch/c14f91d7b7d0cd7454de20db1e3bf55f to your computer and use it in GitHub Desktop.
Save spinsch/c14f91d7b7d0cd7454de20db1e3bf55f to your computer and use it in GitHub Desktop.
create a tld list for copy&paste as php array
<?php
header("Content-type: text/plain");
echo "array(\n";
foreach (new NoRewindIterator(new SplFileObject('https://data.iana.org/TLD/tlds-alpha-by-domain.txt')) as $i => $v) {
if ($i == 0) {continue;};
echo "\040\040\040\040'".idn_to_utf8(trim(strtolower($v)))."',\n";
}
echo ");";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment