dizpers dizpers - 1 year ago 75
Javascript Question

Whois with JavaScript

I want to be able to get whois data (and idn domains too) by client-side javascript. Is it possible? Maybe some free REST-like WhoIs service exists?

Answer Source

Try using http://whoisxmlapi.com service.

The service URL: http://www.whoisxmlapi.com/whoisserver/WhoisService

You need to specify outputFormat=json and domainName=insert_domain_here parameters..

Example URL: http://www.whoisxmlapi.com/whoisserver/WhoisService?outputFormat=json&domainName=stackoverflow.com.

Example code (using jQuery to simplify AJAX communication):

  url: 'http://www.whoisxmlapi.com/whoisserver/WhoisService',
  dataType: 'jsonp',
  data: {
    domainName: 'stackoverflow.com',
    outputFormat: 'json'
  success: function(data) {

HERE is the working code.


The service mentioned above is not free, but there are several free whois services that are providing HTML output and by using YQL you can retrieve the HTML as a JS. See THIS answer for more details.

Example (using jQuery & jquery.xdomainajax):

var domain = 'stackoverflow.com';
  url: 'http://whois.webhosting.info/' + domain,
  type: 'GET',
  success: function(res) {
    // using jQuery to find table with class "body_text" and appending it to a page

HERE is the working code.

You need to have a look at the structure of the HTML document and select, process and display the data you are interested in. The example is just printing whole table without any processing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download