I have seen many WHOIS tags that are hard to figure out or couldn't get them to work. I decided to then make my own that is simple to make and to configure.


<center>
  <cfparam name = "form.domain" default = "xp-resources">
  <cfparam name =
"form.ext" default = ".com">
  <cfparam name =
"action" default = "none">

  <!--- Determines if the form was submitted --->
  <cfif action is "find">
    <!--- This gets the info --->
    <cfhttp url="http://reports.internic.net/cgi-bin/whois?whois_nic=#form.domain##form.ext#&type=domain"
               method=
"GET"
               resolveurl=
"yes"
               throwonerror=
"yes">
     </cfhttp>
     <cfset startat = find(
"<pre>", cfhttp.filecontent, 1)>
     <cfset endat = find(
"</pre>", cfhttp.filecontent, startat)>
     <cfset info_length = int(endat - startat)>
     <cfset info_on = mid(cfhttp.filecontent, startat, info_length)>
     <cfset registered = find("No match for domain", info_on, 1)>


     <cfoutput>
        <!--- This will determine if the domain is registered --->
        <cfif registered neq 0>
            The domain "#form.domain##form.ext#" is available! <br>
        <cfelse>
            The domain "#form.domain##form.ext#" is already registered. <br>
            <br>
            <!--- Shows the results --->
            #info_on# 
        </cfif>
        <br>
    </cfoutput>
  <cfelse>

    <!--- Form for the search --->
    <form method="post" action="#script_name#?action=find">
        Enter Domain: <br>
        <font size="1"> <b>http://www.</b>
        <input type="text" name="domain">
        <select name="ext">
            <option>.com</option>
            <option>.net</option>
            <option>.edu</option>
        </select>
        <input type=
"submit" value="Search">
    </form>

  </cfif>
</center>

Well, there you go. Easy, little code for a simple WHOIS search.
Questions, comments, or anything else, please contact Drew Tempelmeyer
About This Tutorial
Author: Drew Tempelmeyer
Skill Level: Intermediate 
 
 
 
Platforms Tested: CF5
Total Views: 128,009
Submission Date: April 27, 2003
Last Update Date: June 05, 2009
All Tutorials By This Autor: 3
Discuss This Tutorial
  • Hi everyone! internic.net has changed their report URL. So, use and it should work fine! Thanks! Overall, this tutorial is great!

  • I was just curious why a search for google.co.uk comes up as available? is this code limited to just .com, .net, and .edu? i modified it to use others but odd ones like the google ones dont seem to bring back the correct values. says google.com.uk is available when it is not. Thanks Derek email@chaoticharmony.net Other than that the code is simple and great!

  • Hi Well i had tried the code but error displayed Connection Failure: Status code unavailable ...I think the problem is due to slow internet connection speed...i will try later on...but want to say Thanks to the author for getting into deeper roots for helping hundreds of like us... Thanks Jaspal Mehta imjmehta@yahoo.com

  • Is there any way for the code to pull out just the expiration date, and output that?

  • Thanks for this easy yet accomplishing tutorial.

Advertisement

Sponsored By...
Mobile App Development (IOS, Android, Cordova, Phonegap, Objective-C, Java) - Austin, Texas Mobile Apps - Touch512, LLC.