Build Domain WHOIS Lookup System using PHP and Ajax

WHOIS (pronounced as the phrase “who is”) is a query and response protocol that is widely used for querying databases that store the registered users or assignees of an Internet resource, such as a domain name, an IP address block or an autonomous system, but is also used for a wider range of other information. The protocol stores and delivers database content in a human-readable format.
In this tutorial you will learn how to build your own Domain WHOIS Lookup System with PHP and Ajax. This WHOIS PHP script will support all types of domains from all countries all over the world. This is a very simple example, you can just copy paste, and change.
Before started to build your own Domain WHOIS Lookup System with PHP, look files structure:
  • build-domain-whois-lookup-system-using-php
    • css
      • style.css
    • images
    • templates
      • header.php
      • footer.php
    • index.php
    • lookup.php
Step 1: Design Whois Lookup HTML Form
Create file named index.php and design HTML form with a input to enter domain name or IP Address and a search button to get domain WHOIS information on form submit via Ajax.
Step 2: Make Request to Domain WHOIS SERVER — functions
  • Handles the Domain WHOIS Lookup process
  • LookupDomainName() — Lookup Domain Name.
  • LookupIPAddress() — LookupIP Address.
  • ValidateIPAddress() — Validate IP Address.
  • ValidateDomainName() — Validate Domain Name.
  • getWhoisServerDetails() — get Whois Server Details.
Step 3 : Display Domain WHOIS Information
\n”; ?>
Step 4: Make Ajax Request and Load data
Ajax request get domain lookup results from server
Create files named (header.php and footer.php)
This file contains the header and footer section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
header.php
footer.php