Created
April 18, 2020 23:24
-
-
Save deviationist/d3046e7bd12d9f561ad5ae9ce02feaff to your computer and use it in GitHub Desktop.
Get a domain without its subdomain (taking ccSLD into consideration)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// composer require jeremykendall/php-domain-parser | |
require_once __DIR__ . '/vendor/autoload.php'; | |
$manager = new Pdp\Manager(new Pdp\Cache(), new Pdp\CurlHttpClient()); | |
$domain = $manager->getRules()->resolve('this.is.a.very.long.domain.co.uk'); | |
var_dump($domain->getRegistrableDomain()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment