domain checker

Domain Availability Checker PHP Script and Without API Code


How to Create Domain Checker PHP Script Without API?

How to check Domain could be available? One could be a self-hosted PHP script and also the second is a Domain supplier website. these days we have a tendency to ar sharing PHP Domain handiness Checker Script. Through the PHP script quickly and accurately results from you may apprehend.

As we know, to make a brand new web site, we’d like to initial get the name. And currently daily the majority standard or connected named domain has already registered. therefore it’s terribly tough to urge a particular name. Thus, we’ve got to visualize the name is offered or has already been registered.

Many Domain registrations and internet hosting service supplier corporations offer facilities to visualize Domain handiness on their website. however, If you would like to form your own tool to visualize the supply of domain names then here we have a tendency to share merely PHP script to form your own Domain checker tool. therefore let’s see the Domain handiness checker script in PHP.

Instantly Domain handiness Checker In PHP
This program created a type with HTML and CSS. within the type part, we have a tendency to the additional fields and additional search button. once submitting the shape it’ll decision gethostbyname() PHP operate. This operates merely returns associate IPv4 address admire a given web hostname. If associate entered name isn’t offered then this operate returns associate IPv4 address. And if the name is offered then this operate returns an identical name string. Finally, we have a tendency to check if condition and provides an end product of Domain handiness.

Live Demo:-

Domain availability checker PHP script and without API code

Check Domain Name Availability (Without API Code)

Code here

<!DOCTYPE html>
<html lang="en">
<!-- Copyright - 2021 © My Programing All rights reserved. --> 
<!-------https://www.myprograming.com/----------------->
    <head>
        <title>Domain availability checker PHP script and without  API code</title>    
    </head>
    <body>
        <div class="wrapper">
            <h2>Check Domain Name Availability (Without  API Code)</h2>
            <div class="containerform">
                <form action="#" method="GET">
                    <input id="searchBar" class="searchbar" type="text" name="domain" placeholder="Search domain name..." value="<?php if(isset($_GET['domain'])){ echo $_GET['domain']; } ?>">
                    <button type="submitbtn" id="btnSearch" class="btn-search"><i class="fa fa-search"></i></button>
                </form>
            </div>
            <?php
                error_reporting(0);
                if(isset($_GET['domain'])){
                    $domain = $_GET['domain'];
                    if ( gethostbyname($domain) != $domain ) {
                        echo "<h3 class='fail'>Domain Already Registered!</h3>";
                    }
                    else {
                        echo "<h3 class='success'>Hurry, your domain is available!, you can register it.</h3>";
                    }
                }
            ?>
        </div>

        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"/>
        <style type="text/css">
            .wrapper {
                font-weight: normal;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                color: #333;
                background-color: #f4f4f4;
            }
            .wrapper {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                height: 90vh;
            }
            .wrapper h2 {
                font-size: 26px;
                text-align: center;
            }
            .wrapper h3 {font-size: 24px; }
            .wrapper h3.success {
                color: #008000;
                text-align: center;
            }
            .wrapper h3.fail {
                color: #ff0000;
                text-align: center;
            }
            .containerform {
                display: flex;
                flex-direction: row;
                justify-content: center;
                align-items: center;
            }
            .searchbar {
                padding: 6px 10px;
                width: 400px;
                max-width: 100%;
                border: none;
                margin-top: 1px;
                margin-right: 8px;
                font-size: 1em;
                border-bottom: #333 solid 2px;
                transition: 0.3s;
            }
            .searchbar::placeholder {
                font-size: 1em;
            }
            .searchbar:focus {
                outline: none;
            }
            .btn-search {
                cursor: pointer;
                text-decoration: none !important;
                font-size: 1.5em;
                padding-top: 5px;
                padding-bottom: 5px;
                background-color: transparent;
                border: none;
                outline: none;
            }
        </style>
    </body>
</html>

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *