1. Go to this page and download the library: Download xoops/regdom library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xoops / regdom example snippets
use Xoops\RegDom\RegisteredDomain;
$regdom = new RegisteredDomain();
echo $regdom->getRegisteredDomain('https://www.google.com/');
// Output: google.com
echo $regdom->getRegisteredDomain('theregister.co.uk');
// Output: theregister.co.uk
var_dump($regdom->getRegisteredDomain('co.uk'));
// Output: NULL (co.uk is a public suffix, not a registrable domain)
// IDN support (
use Xoops\RegDom\RegisteredDomain;
// Validates if a cookie domain is appropriate for a given host
RegisteredDomain::domainMatches('www.example.com', 'example.com'); // true
RegisteredDomain::domainMatches('example.com', 'com'); // false (public suffix)
RegisteredDomain::domainMatches('google.com', 'facebook.com'); // false (cross-domain)
RegisteredDomain::domainMatches('192.168.1.1', '192.168.1.1'); // false (IP addresses)