Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8457835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:54:49+00:00 2026-06-10T12:54:49+00:00

I want to integrate one API with one of my website which is a

  • 0

I want to integrate one API with one of my website which is a task given by my senior.The API is about searching domain name already present or not..please help me on this topic
please give me n example which i can refer.my website is in PHP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:54:50+00:00Added an answer on June 10, 2026 at 12:54 pm

    [EDIT 2] As @Poe mentions in his comment, gethostbyname is probably a much better solution because it works for any top level domain, since it performs a DNS query instead of a whois query, and is also much simpler to implement and probably faster:

    <?php
    $ip = gethostbyname('example.com');
    if (strstr($ip,"example.com")){
        echo "No match for domain example.com<br />\n";
    } else {
        echo "Domain found. Query output: <br />\n".$ip;
    }
    ?>
    

    Anyway, a domain can be registered but its not linked to any computer (E.g. although it’s very uncommon, you may get an resolution for http://www.example.com but not example.com)

    [EDIT] I didn’t post this before because I was having some trouble connecting to whois.internic.net on port 43 to perform a whois query (thought they had shutdown the service for good). Anyway, here’s a fsockopen based solution I just coded, which I think is far better and simpler than the solution I gave before using their CGI web script. Hope it helps (Usage: myqueryscript.php?domain=domainiwanttocheck.com):

    <?php
    $fp = fsockopen("199.7.58.74", 43, $errno, $errstr, 30);
    if (!$fp) {
        echo "$errstr ($errno)<br />\n";
    } else {
        $query = $_GET['domain']."\r\n";
        $answer= '';
        fwrite($fp, $query);
        while (!feof($fp)) {
            $answer .= fgets($fp, 128)."<br />";
        }
        fclose($fp);
        if (strstr($answer,"No match for")){
            echo "No match for domain ".$_GET['domain']."<br />\n";
        } else {
            echo "Domain found. Query output: <br />\n".$answer;
        }
    }
    ?>
    

    From internic website, this is the html code to implement a whois query:

    <form method="get" action="http://reports.internic.net/cgi/whois" name="my_form">
                <input type="text" size="30" name="whois_nic" maxlength="80">
                <br>
                <input type="radio" name="type" value="domain" checked>
                Domain<font size="-1"> (ex. internic.net)
                <br>
                <input type="radio" name="type" value="registrar">
                Registrar<font size="-1"> (ex. ABC Registrar, Inc.) 
                <br>
                <input type="radio" name="type" value="nameserver">
                Nameserver (ex. NS.EXAMPLE.COM or 192.16.0.192)<br>
                <br>
                <input type="submit" value="Submit">
      </form>
    

    This means you can send a whois query like this: http://reports.internic.net/cgi/whois?whois_nic=domainiwanttocheck.com&type=domain

    You can send the query from your script and store the response on a DOMDocument object. Check out: http://www.php.net/manual/en/domdocument.loadhtml.php

    If you use this method to lookup a domain and the domain doesn’t exist, you’ll get the string No match for domain. Look for this in the response using strpos

    If the domain exists, you can filter the response to include the info about registrar, etc. It will be the content of the html tag <pre> of the response:

    <pre>
    
    Whois Server Version 2.0
    
    Domain names in the .com and .net domains can now be registered
    with many different competing registrars. Go to http://www.internic.net
    for detailed information.
    
       Domain Name: GOOGLE.COM
       Registrar: MARKMONITOR INC.
       Whois Server: whois.markmonitor.com
       Referral URL: http://www.markmonitor.com
       Name Server: NS1.GOOGLE.COM
       Name Server: NS2.GOOGLE.COM
       Name Server: NS3.GOOGLE.COM
       Name Server: NS4.GOOGLE.COM
       Status: clientDeleteProhibited
       Status: clientTransferProhibited
       Status: clientUpdateProhibited
       Status: serverDeleteProhibited
       Status: serverTransferProhibited
       Status: serverUpdateProhibited
       Updated Date: 20-jul-2011
       Creation Date: 15-sep-1997
       Expiration Date: 14-sep-2020
    
    >>> Last update of whois database: Sat, 25 Aug 2012 10:15:09 UTC <<<
    
    NOTICE: The expiration date displayed in this record is the date the 
    registrar's sponsorship of the domain name registration in the registry is 
    currently set to expire. This date does not necessarily reflect the expiration 
    date of the domain name registrant's agreement with the sponsoring 
    registrar.  Users may consult the sponsoring registrar's Whois database to 
    view the registrar's reported date of expiration for this registration.
    
    TERMS OF USE: You are not authorized to access or query our Whois 
    database through the use of electronic processes that are high-volume and 
    automated except as reasonably necessary to register domain names or 
    modify existing registrations; the Data in VeriSign Global Registry 
    Services' ("VeriSign") Whois database is provided by VeriSign for 
    information purposes only, and to assist persons in obtaining information 
    about or related to a domain name registration record. VeriSign does not 
    guarantee its accuracy. By submitting a Whois query, you agree to abide 
    by the following terms of use: You agree that you may use this Data only 
    for lawful purposes and that under no circumstances will you use this Data 
    to: (1) allow, enable, or otherwise support the transmission of mass 
    unsolicited, commercial advertising or solicitations via e-mail, telephone, 
    or facsimile; or (2) enable high volume, automated, electronic processes 
    that apply to VeriSign (or its computer systems). The compilation, 
    repackaging, dissemination or other use of this Data is expressly 
    prohibited without the prior written consent of VeriSign. You agree not to 
    use electronic processes that are automated and high-volume to access or 
    query the Whois database except as reasonably necessary to register 
    domain names or modify existing registrations. VeriSign reserves the right 
    to restrict your access to the Whois database in its sole discretion to ensure 
    operational stability.  VeriSign may restrict or terminate your access to the 
    Whois database for failure to abide by these terms of use. VeriSign 
    reserves the right to modify these terms at any time. 
    
    The Registry database contains ONLY .COM, .NET, .EDU domains and
    Registrars.
            </pre>
    

    Also, check out this related question: Who provides a WHOIS API?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to integrate one of image search api for finding similar image like
I'm new one to Yii Framework, and i want to integrate the Website search
I want integrate CPD (Copy-Paste-Detection) to my iOS project. I read about it here
i want to integrate facebook like button into my website . My website has
I am currently working on one travel domain where I need to integrate Trip
I have one Spreadsheet file in my Google Drive which i want to sync
I am new to facebook api, and want to integrate in an site of
I am new to Google Map API and i want to integrate Google Map
I want to integrate Joomla with one of existing applications. My application is also
I want to integrate https://www.usps.com/ and also fedex api on my rails application, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.