usrflo / registered-domain-libs Goto Github PK
View Code? Open in Web Editor NEWDetect the registered domain for a given domain name in C, Perl and PHP, based on Mozillas effective TLD listing
Detect the registered domain for a given domain name in C, Perl and PHP, based on Mozillas effective TLD listing
require_once("registered-domain-libs/effectiveTLDs.inc.php");
require_once("registered-domain-libs/regDomain.inc.php");
getRegisteredDomain('subdomain.domain.co.uk');
// this print "co.uk"
getRegisteredDomain('subdomain.domain.co.uk', $tldTree);
// this print "co.uk"
It seems any IDN can't get past the regexp in regDomain.class.php
:
if (!preg_match("/^([a-z0-9])(([a-z0-9-])*([a-z0-9]))*$/", $domPart)) return FALSE;
If anybody's interested, the library could be augmented to support UTF8 letter characters by adding the \p{L}
character set along with a-z0-9
and adding /u
at the end:
if (!preg_match("/^([a-z0-9\p{L}])(([a-z0-9-\p{L}])*([a-z0-9\p{L}]))*$/u", $domPart)) return FALSE;
I tested it as such and it worked:
echo (new regDomain())->getRegisteredDomain("example.мон", false);
And it works for that IDN (.xn--l1acc):
example.мон
I could submit a pull request if nobody sees an issue
Just wanted to tell that TLD Array in registered-domain-libs/PHP/effectiveTLDs.inc.php get empty in this commit d76e2a3
Might be by mistake.
As mentioned in publicsuffix/list#1872 (comment)
Multiple psl
libraries share the same bug while handling wildcards.
I went over all the FOSS implementations in https://publicsuffix.org/learn/ , and I found 3 of them behave funny for
wildcard
domains. In particular:Seems to all mislabel eTLD-
n
x
[eTLD minusn
] (with n from0
toinfinite
), as an eTLD, if another eTLDy
is defined as a subdomain of thatx
eTLD-n
.As an example
publicsuffix2
behaviour with the following patch:// Linode : https://linode.com // Submitted by <[email protected]> members.linode.com -nodebalancer.linode.com +*.nodebalancer.linode.com +*.linodeobjects.com +ip.linodeusercontent.com
Example here:
Hi,
is that normal that none of amazonaws.com hosts are found ?
ex: kinesis.us-east-1.amazonaws.com
each time it gives NULL
bye Fred
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.