@Karaman; şu örnekte işine yarayabilir.
Bilgisayarınızda veya sunucunuzda
Composer kurulu değilse
şu yazımı okumanızı tavsiye ediyorum.
composer.json;
{
"minimum-stability": "dev",
"require": {
"jeremykendall/php-domain-parser": "0.0.*"
}
}test.php;
<?php
error_reporting(E_ALL);
set_include_path(str_replace("\\", "/", dirname(realpath(__FILE__))));
date_default_timezone_set("Europe/Istanbul");
require("vendor/autoload.php");
use \Pdp\Parser;
use \Pdp\PublicSuffixListManager;
$pslManager = new PublicSuffixListManager();
$parser = new Parser($pslManager->getList());
$hosts = array("github.com", "www.path.com", "saintx.net", "turkiye.gov.tr", "google.com.tr", "ttnet.com.tr", "www.metu.edu.tr");
foreach($hosts as $host)
{
$suffix = $parser->parseHost($host)->publicSuffix;
echo "{$host}: publicSuffix -> {$suffix} <br />";
}çıktı;