TR

How to create a domain lookup page with PHP?

PHP is a programming language used to create web applications. A domain lookup page is a tool that allows users to check if a domain name is available. Such a page enables users to make a WHOIS query for a specific domain name and get the results.

 'whois.verisign-grs.com',
    'net' => 'whois.verisign-grs.com',
    'org' => 'whois.pir.org',
    'biz' => 'whois.biz',
    'info' => 'whois.afilias.net',
    'clup' => 'whois.nic.club',
    'site' => 'whois.nic.site',
    'pro' => 'whois.afilias.net',
    'com.tr' => 'whois.nic.tr'
);

foreach ($whois_servers as $key => $server):
    $socket = fsockopen($server, 43, $errno, $errstr,10);
    if($socket):
        fputs($socket, $domain.".".$key. "\r\n");
        while (!feof($socket)): $response .= fgets($socket, 128); endwhile;
        fclose($socket); $response = strtolower($response);
        if(strstr($response, 'no match found') || strstr($response,"no match for")  || strstr($response,"domain not found") || strstr($response,"no data found")):
            echo $domain.".".$key." Bu domain müsait";
        else:
            echo $domain.".".$key." Bu domain değil";
        endif;
    endif;
endforeach;

In the internet world, when creating a website or acquiring an existing domain, it's important to check if a domain is available. The PHP programming language provides a useful tool for performing such a query. In this article, you've learned how to query the status of a domain using PHP.

In this article, you learned two different methods to query a domain using PHP: WHOIS-based querying and DNS-based querying. With WHOIS, you can obtain registration information, and with DNS, you can resolve the IP address of the domain. Using this information, you can check the status of a domain and take appropriate actions when creating a website or acquiring an existing domain.

Keywords: PHP, domain lookup, domain availability check, WHOIS, DNS

whatsapp ile iletişime geç butonu