Finding the right domain name is the first and most important step when launching a startup, brand, or online project. To make this process fast and intuitive, I built a premium, real-time domain checker using PHP, AJAX, DNS lookups, WHOIS fallback, and Tailwind CSS.
This tool provides instant results, smart TLD suggestions, and a clean modern UI — similar to what you see on domain providers like Namecheap, GoDaddy, or Porkbun.
In this article, I’ll walk you through the system’s features, how it works and you can try the demo to experience it yourself.
Project Overview
This project is a full mini-application that lets users:
- Search for any domain in real time
- Automatically check DNS records
- Fall back to WHOIS servers for deeper verification
- Get intelligent domain name suggestions
- Enjoy a beautiful, premium landing page UI
- View results instantly without reloading the page
All powered by a lightweight backend in PHP and a sleek frontend with Tailwind CSS.
Project Structure
/
│ index.php → UI + AJAX logic
│
└── api/
└── check.php → DNS + WHOIS backend logic
index.php
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Premium Domain Search — Landing Page</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gradient-to-br from-slate-900 via-gray-900 to-black text-white min-h-screen">
<!-- Hero Section -->
<section class="pt-20 pb-32 text-center px-6">
<h1 class="text-5xl md:text-6xl font-extrabold bg-gradient-to-r from-blue-400 to-purple-400 text-transparent bg-clip-text drop-shadow-xl">
Find Your Perfect Domain
</h1>
<p class="mt-4 text-gray-300 max-w-2xl mx-auto text-lg">
Search across multiple TLDs in real-time with premium DNS + WHOIS checking.
</p>
<div class="mt-10 max-w-3xl mx-auto">
<form id="domainForm" class="flex flex-col md:flex-row gap-4">
<input id="domainInput" placeholder="Type a name... (e.g., startup)" class="flex-1 bg-white/10 border border-white/20 rounded-2xl px-6 py-4 text-white placeholder-gray-400 focus:border-blue-400 outline-none shadow-lg" />
<select id="tldSelect" class="bg-white/10 border border-white/20 rounded-2xl px-4 py-4 focus:border-blue-400 outline-none shadow-lg">
<option value="com">.com</option>
<option value="net">.net</option>
<option value="org">.org</option>
<option value="io">.io</option>
<option value="ai">.ai</option>
<option value="xyz">.xyz</option>
</select>
<button id="checkBtn" class="bg-gradient-to-r from-blue-500 to-purple-500 hover:from-blue-600 hover:to-purple-600 px-8 py-4 rounded-2xl shadow-xl font-semibold transition">Search</button>
</form>
</div>
<div id="results" class="mt-10"></div>
<div id="suggestions" class="mt-12 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 max-w-4xl mx-auto"></div>
</section>
<!-- Footer -->
<footer class="py-10 text-center text-gray-400 text-sm">
© 2025 Y2A System — Premium Domain Checker
</footer>
<script>
const domainInput = document.getElementById('domainInput');
const tldSelect = document.getElementById('tldSelect');
const domainForm = document.getElementById('domainForm');
const results = document.getElementById('results');
const suggestionsBox = document.getElementById('suggestions');
let controller = null;
function normalizeDomain(input, tld) {
input = input.trim().toLowerCase();
input = input.replace(/^https?:\/\//, '').replace(/\/$/, '').replace(/^www\./, '');
if (/\.[a-z]{2,}$/i.test(input)) return input;
return input + '.' + tld;
}
function createSuggestions(base) {
const tlds = ['com','net','org','io','ai','xyz','co','info'];
return tlds.map(t => `${base}.${t}`);
}
function showSuggestions(list) {
suggestionsBox.innerHTML = list.map(d => `
<div class='p-4 bg-white/10 rounded-xl border border-white/10 hover:bg-white/20 transition cursor-pointer' onclick="checkDomain('${d}')">
${d}
</div>
`).join('');
}
function renderMessage(html) {
results.innerHTML = html;
}
async function checkDomain(domain) {
if (controller) controller.abort();
controller = new AbortController();
renderMessage(`<div class='p-6 bg-white/10 rounded-xl animate-pulse'>Checking <strong>${domain}</strong>...</div>`);
try {
const resp = await fetch('api/check.php?domain=' + encodeURIComponent(domain), {signal: controller.signal});
const data = await resp.json();
if (data.available) {
renderMessage(`
<div class='p-6 bg-green-500/20 border border-green-500/30 rounded-xl text-green-300'>
<div class='text-2xl font-bold'>✔ ${domain} is Available</div>
</div>
`);
} else {
renderMessage(`
<div class='p-6 bg-red-500/20 border border-red-500/30 rounded-xl text-red-300'>
<div class='text-2xl font-bold'>✖ ${domain} is Taken</div>
</div>
`);
}
} catch (err) {
if (err.name !== 'AbortError') renderMessage(`<div>Error: ${err.message}</div>`);
}
}
let typingTimer;
const TYPING_DELAY = 600;
domainInput.addEventListener('input', () => {
clearTimeout(typingTimer);
const base = domainInput.value.trim().toLowerCase().replace(/\.[a-z]{2,}$/, '');
if (base) showSuggestions(createSuggestions(base));
typingTimer = setTimeout(() => {
const domain = normalizeDomain(domainInput.value, tldSelect.value);
checkDomain(domain);
}, TYPING_DELAY);
});
domainForm.addEventListener('submit', (e) => {
e.preventDefault();
const domain = normalizeDomain(domainInput.value, tldSelect.value);
checkDomain(domain);
});
</script>
</body>
</html>
api/check.php
<?php
// api/check.php
header('Content-Type: application/json; charset=utf-8');
function jsonResponse($data) {
echo json_encode($data);
exit;
}
if (!isset($_GET['domain']) || trim($_GET['domain']) === '') {
jsonResponse(['error' => 'No domain provided']);
}
$domain = trim(strtolower($_GET['domain']));
// sanitize and basic validation
if (!preg_match('/^[a-z0-9-\.]{1,253}\.[a-z]{2,63}$/', $domain)) {
jsonResponse(['error' => 'Invalid domain format']);
}
// split tld
$parts = explode('.', $domain);
$tld = array_pop($parts);
// first fast check: DNS
$hasDns = checkdnsrr($domain, 'A') || checkdnsrr($domain, 'AAAA') || checkdnsrr($domain, 'CNAME') || checkdnsrr($domain, 'MX');
if ($hasDns) {
jsonResponse(['domain' => $domain, 'available' => false, 'whois_checked' => false]);
}
// WHOIS fallback for common TLDs
$whoisServers = [
'com' => 'whois.verisign-grs.com',
'net' => 'whois.verisign-grs.com',
'org' => 'whois.pir.org',
'io' => 'whois.nic.io',
'ai' => 'whois.nic.ai',
'xyz' => 'whois.nic.xyz',
];
if (!isset($whoisServers[$tld])) {
// unknown TLD: respond with DNS result (which was negative) but note WHOIS not supported
jsonResponse(['domain' => $domain, 'available' => null, 'whois_checked' => false, 'error' => 'TLD not supported for WHOIS check']);
}
$server = $whoisServers[$tld];
$port = 43;
$timeout = 10;
$response = '';
$fp = @fsockopen($server, $port, $errno, $errstr, $timeout);
if (!$fp) {
jsonResponse(['domain' => $domain, 'available' => null, 'whois_checked' => false, 'error' => 'Unable to query WHOIS server']);
}
fwrite($fp, $domain . "\r\n");
stream_set_timeout($fp, $timeout);
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
$responseLower = strtolower($response);
// heuristics for "not found" in WHOIS responses
$notFoundMarkers = [
'no match',
'not found',
'available',
'domain not found',
];
$isAvailable = false;
foreach ($notFoundMarkers as $m) {
if (strpos($responseLower, $m) !== false) {
$isAvailable = true;
break;
}
}
if ($isAvailable) {
jsonResponse(['domain' => $domain, 'available' => true, 'whois_checked' => true]);
}
// If not available, try to parse registrar or mark taken
$registrar = null;
if (preg_match('/registrar:\s*(.+)/i', $response, $m)) {
$registrar = trim($m[1]);
}
jsonResponse(['domain' => $domain, 'available' => false, 'whois_checked' => true, 'registrar' => $registrar]);
Technology Stack
Frontend
- Tailwind CSS (CDN)
- Vanilla JavaScript (AJAX)
- Responsive UI components
Backend
- PHP 7.4+
fsockopen for WHOIScheckdnsrr() for instant DNS checks
No frameworks needed.
Project Demo
Performance & Scalability
This system performs well because it:
- Uses DNS for fast checks
- Only uses WHOIS when necessary
- Aborts previous requests when user keeps typing
- Supports caching & rate-limiting (optional upgrades)
For heavy production use, you may add:
- Redis cache
- WHOIS API provider integration
- Nginx microcaching
Security Notes
- Limit WHOIS queries per IP
- Sanitize domain input
- Avoid exposing WHOIS raw output to users
- Use HTTPS for securely transmitting queries
The provided backend already includes format validation.
This PHP AJAX Domain Checker combines speed, accuracy, and a stunning UI—making domain search feel effortless and modern.
Whether you're building a hosting platform or simply want to offer domain lookup on your site, this system provides a powerful and elegant foundation.