Skip to content

PHP code to build TLD Suffix set from publicsuffix.org, as well as a class for determining a domain's public suffix.

License

Notifications You must be signed in to change notification settings

table/effective-TLDs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

effective-TLDs

PHP code to build TLD Suffix set from publicsuffix.org, as well as a class for determining a domain's public suffix. Handles wildcards and exception cases. Correctly gives the public suffix for omg.blogspot.com.au ('omg.blogspot.com.au'), omg.com.au ('omg.com.au'), and omg.au (null), whereas other implementations in PHP either have trouble or onerous licensing.

Installation

Download the files and place them somewhere in your PHP include path. Alternatively, specify a fully qualified path in your includes.

require_once('class.EffectiveDomain.php');

Use

echo EffectiveDomain::getPublicSuffix("omg.hillgod.com")."\n";
$> php myScript.php
hillgod.com
$>

Updating TLDs

updateEffectiveTLDs.php is included to build effectiveTLDs.inc.php from the latest list of public suffixes at Publicsuffix.org. This link can be modified in updateEffectiveTLDs.php.

$> php updateEffectiveTLDs.php > effectiveTLDs.inc.php

About

PHP code to build TLD Suffix set from publicsuffix.org, as well as a class for determining a domain's public suffix.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%