This post explain how to check domain name is valid or not
Domain Name Full fill the following Conditions
Check Valid domain name in php using Regular Express and preg_match
Domain Name Full fill the following Conditions
- Domain Name Must contain Alpha Numeric
- Only special character (-) hyphen. is allowed on domain names.
- Check the generic domain extension (.com, .edu, .gov, .int, .mil, .net, and .org)
- All International domain extensions (TLDs) approved by ICANN
Check Valid domain name in php using Regular Express and preg_match
<?php function is_valid_domain_extension($domain) { return preg_match('/^([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)|(c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]|(g[abdefghilmnpqrstuwy]|gov)|h[kmnrtu]|(i[delmnoqrst]|info|int)|(j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]|(m[acdghklmnopqrstuvwxyz]|mil|mobi|museum)|(n[acefgilopruz]|name|net)|(om|org)|(p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]|(t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw])$/i',$domain); } // Example example.mz // .MZ the domain for Republic of Mozambique // I aware of the Region when I am working for this function. echo is_valid_domain_extension("example.mz"); // ?>
Thanks for your help is really usefull..
ReplyDeleteGreat improvement for our tutorial, we cited you as source! Thanks :)
ReplyDelete