skip to Main Content

I want to built a domain name availability checker, but I can’t find the proper info. I just want to check if the domain is still available or not. I already made a form on my website (https://prnt.sc/s2p0qr), and with jQuery I have collected the domain name to look for. So now I want to make an ajax request to check if the domain is still available.

What are the next steps? From the little tutorials I found, I know that I now have to send a GET request with the domain name to some DNS lookup provider(s)? (correct me if I’m wrong)

Where do I find these providers? And which url to send? How do I get around this info?

There seems to be less info on this matter.

My code so far:

/**
 * Domain name ajax lookup
 */
$('#domainSearch form').on('submit', function (event) {
    event.preventDefault();
    const domainName = $(this).find('#domainName').val();
    const popularTld = ($(this).find('#popularTld input:checked'));
    const allTld = ($(this).find('#allTld input:checked'));
    const tld = [];
    let error = '';

    if (domainName.length <= 2) {
        error = 'Geen geldige domeinnaam';
        $(this).find('.alert').html(error);
        $(this).find('.alert').slideDown();
    } else {
        $(this).find('.alert').slideUp();
        popularTld.each(function () {
            tld.push(domainName + '.' + $(this).val());
        });
        allTld.each(function () {
            tld.push(domainName + '.' + $(this).val());
        });
        for (var i = 0; i < tld.length; i++) {
            console.log(tld[i]);
            $.get({
                url: 'https://www.name.com/domain/search/' + tld[i] + '',
                success: function (result) {
                    console.log(result);
                }
            });
        }
    }
});

2

Answers


  1. From glancing at your code, your question seems to be more about scraping data from a web page, than about determining domain availability. e.g. you are checking what name.com shows on their website for a given domain name.

    You’ll have more success looking for tutorials about scraping data with your programming language of choice.

    (Full disclosure: I helped make domainr.com, which provides an API for what you are asking.)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search