How to create a domain checker using PHP? - Blog Desire

PHOTO EMBED

Sun Mar 31 2024 13:17:33 GMT+0000 (Coordinated Universal Time)

Saved by @Angel

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Domain checker</title>
	<link rel="stylesheet" href="./style.css">
</head>
<body>
	<div id="wrapper">		
		<form method="POST">
			<input type="text" name="domain" <?php if(isset($_POST['domain'])) echo 'value="'.$_POST['domain'].'"' ?>>
			<button type="submit">Check</button>
		</form>
		<div class="result">
			<?php 
				if(isset($_POST['domain'])){
					if ( gethostbyname($_POST['domain']) == $_POST['domain'] )
					    echo "<p class='success'>Congatulations! {$_POST['domain']} is available</p>";
					else
						echo "<p class='failur'>Sorry, {$_POST['domain']} is not available</p>";
				}
			?>
		</div>
	</div>
</body>
</html>
content_copyCOPY

https://www.blogdesire.com/how-to-create-a-domain-checker-using-ph/