php - Tool Suggest Top-Level Domains -
i creating tool our customers check if domain name exists. plan on using gethostbyname($domain) function. but, want pre-program other tld's checked along preferred tld (sent through form). don't know start here included example below user suggestions.
// supported top-level domain names (tlds) $tld['coming_soon'] = ".realty, .construction"; $tld['current'] = ".com, .org, .us"; // receive form data , strip tags $source = $_server['http_referer']; $domain = strip_tags($_post['domain_name']); $tld = strip_tags($_post['tld']); $req = $domain.$tld; // check client's preferred domain if ( gethostbyname($req) != $req ) { echo "dns record found"; } else { echo "no dns record found"; } // do: check alternative top-level domains // do: somehow search through $tld array, compare, , give result
gethostbyname($domain)
not sufficient; tell if domain active, not whether available purchase or not.
to find out whether it's available buy, need query relevant whois service each domain type. differ each domain type, , parsing resulting data can pain, better off using api
the registrars you're using register domains should able provide api can call. contact them , find out have , how use it. that's best option.
Comments
Post a Comment