Image Alt

Code Examples

Code Examples

Please read the API documentation before you start using our APIs in production.
The API key used in these examples is for demonstrative purposes and can be used only to check whoapi.com

PHP

Basic PHP example using cURL. We will get whois information for the domain name “whoapi.com”.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "whois";          // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" was created: ".$output['date_created'];
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We’re going to use our Whois API to get whois information for the domain name “whoapi.com”.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "whois";           // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain was created: " + json.date_created;
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We’re going to use our Whois API to get whois information for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "whois"        # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain was created: " + output["date_created"]
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We’re going to use our Whois API to get whois information for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain was created: " + data['date_created'])
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'whois'             # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We’re going to use our Whois API to get whois information for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"whois";          // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Domain was created: %@", responseDictionary[@"date_created"]);
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We’re going to use our Whois API to get whois information for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "whois"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine(String.Format("Success. Domain was created: {0}", json["date_created"]));
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get whois information for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "whois"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }

        String date = myResponse.getString("date_created");
        System.out.println("Success. Domain was created: " + date);

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. We will check if the domain name “whoapi.com” is available for registration.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "taken";          // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" is: ".($output['taken'] == 1 ? "Taken" : "Not taken");
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We’re going to use our Domain Availability API to check if the domain name “whoapi.com” is available for registration.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "taken";           // check availability
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain is: " + (json.taken == 1 ? "Taken" : "Not taken");
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We’re going to check if the domain name “whoapi.com” is available for registration.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "taken"        # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain is: " + (output["taken"].to_i == 1 ? "Taken" : "Not taken")
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We’re going to use our Domain Availability API to check if the domain name “whoapi.com” is available for registration.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain is: " + "Taken" if int(data['taken']) == 1 else "Not taken")
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'taken'             # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We’re going to use our Domain Availability API to check if the domain name “whoapi.com” is available for registration.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"taken";          // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                if([responseDictionary[@"taken"] isEqualToNumber:@1])
                {
                    NSLog(@"Success. Domain is: Taken\n");
                } else {
                    NSLog(@"Success. Domain is: Not taken\n");
                }
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We’re going to use our Domain Availability API to check if the domain name “whoapi.com” is available for registration.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "taken"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            if (json.Value<int>("taken") == 1)
            {
                Console.WriteLine("Success. Domain is: Taken");
            }
            else
            {
                Console.WriteLine("Success. Domain is: Not taken");
            }
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We’re going to use our Domain Availability API to check if the domain name “whoapi.com” is available for registration.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "taken"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }

        int taken = myResponse.getInt("taken");
        System.out.println("Success. Domain is: " + (taken == 1 ? "Taken" : "Not taken"));

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. First, we will send domain “whoapi.com” for the scoring.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "domainscore";    // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" was sent for the scoring.";
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Second, we will request the scoring result.

<?php
// Prepare vars
$domain    = "whoapi.com";          // domain to check
$r         = "domainscore-check";   // request type
$apikey    = "demokey";             // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    // The result is not yet ready
    if (!isset($output['results'][0]['overall_score'])) {
        echo "Success. Domain \"$domain\" is not yet scored. Try again later";
    } else {
        echo "Success. Domain \"$domain\" was scored: ".$output['results'][0]['overall_score'];
    }
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

First, we will send domain “whoapi.com” for the scoring.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "domainscore";     // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain was sent for the scoring.";
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Second, we will request the scoring result.

<script type="text/javascript">
var domain     = "whoapi.com";            // domain name you want to check
var r          = "domainscore-check";     // request type
var apikey     = "demokey";               // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            // The result is not yet ready
            if (!json?.results[0]?.overall_score) {
                document.getElementById("result").innerHTML = "Success. Domain is not yet scored. Try again later";
            } else {
                document.getElementById("result").innerHTML = "Success. Domain was scored: " + json.results[0].overall_score;
            }
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

First, we will send domain “whoapi.com” for the scoring.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "domainscore"  # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain was sent for the scoring."
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Second, we will request the scoring result.

require 'open-uri'
require 'json'

domain     = "whoapi.com"           # domain to check
r          = "domainscore-check"    # request type
apikey     = "demokey"              # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 if output["results"][0]["overall_score"].nil?
  puts "Success. Domain is not yet scored. Try again later"
 elsif
  puts "Success. Domain was scored: " + output["results"][0]["overall_score"].to_s
 end
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

First, we will send domain “whoapi.com” for the scoring.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain was sent for the scoring.")
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'domainscore'       # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Second, we will request the scoring result.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            if data["results"][0]["overall_score"] is None:
                print("Success. Domain is not yet scored. Try again later")
            else:
                print("Success. Domain was scored: " + str(data["results"][0]["overall_score"]))
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'domainscore-check' # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

First, we will send domain “whoapi.com” for the scoring.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"domainscore";    // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Domain was sent for the scoring.");
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

Second, we will request the scoring result.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";         // domain to check
    NSString *r        = @"domainscore-check";  // request type
    NSString *apikey   = @"demokey";            // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                if (responseDictionary[@"results"][0][@"overall_score"] == nil)
                {
                    NSLog(@"Success. Domain is not yet scored. Try again later\n");
                } else {
                    NSLog(@"Success. Domain was scored: %@", responseDictionary[@"results"][0][@"overall_score"]);
                }
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

First, we will send domain “whoapi.com” for the scoring.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "domainscore"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine("Success. Domain was sent for the scoring.");
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Second, we will request the scoring result.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "domainscore-check"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            if (json["results"][0]["overall_score"].Type == JTokenType.Null)
            {
                Console.WriteLine("Success. Domain is not yet scored. Try again later");
            }
            else
            {
                Console.WriteLine(String.Format("Success. Domain was scored: {0}. ", json["results"][0]["overall_score"]));
            }
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

First, we will send domain “whoapi.com” for the scoring.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "domainscore"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }
        
        System.out.println("Success. Domain was sent for the scoring.");
        
      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

Second, we will request the scoring result.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
import org.json.JSONArray;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "domainscore-check"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }
        
        JSONArray results = myResponse.getJSONArray("results");
        
        if (results.getJSONObject(0).isNull("overall_score")) {
          System.out.println("Success. Domain is not yet scored. Try again later");
        } else {
          int overallScore = results.getJSONObject(0).getInt("overall_score");
          System.out.println("Success. Domain was scored: " + overallScore);
        }

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. We will get blacklist information for the domain name “whoapi.com”.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "blacklist";      // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" is: ".(!empty($output['blacklisted']) ? "Blacklisted" : "Not blacklisted");
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We will get blacklist information for the domain name “whoapi.com”.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "blacklist";       // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain is: " + (json.blacklisted ? "Blacklisted" : "Not blacklisted");
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We will get blacklist information for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "blacklist"    # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain is: " + (output["blacklisted"].to_i == 1 ? "Blacklisted" : "Not blacklisted")
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We will get blacklist information for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain is: " + "Blacklisted" if int(data['blacklisted']) == 1 else "Not blacklisted")
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'blacklist'         # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We will get blacklist information for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"blacklist";      // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                if([responseDictionary[@"blacklisted"] isEqualToString:@"1"])
                {
                    NSLog(@"Success. Domain is: Blacklisted\n");
                } else {
                    NSLog(@"Success. Domain is: Not blacklisted\n");
                }
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We will get blacklist information for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "blacklist"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            if (json.Value<int>("blacklisted") == 1)
            {
                Console.WriteLine("Success. Domain is: Blacklisted");
            }
            else
            {
                Console.WriteLine("Success. Domain is: Not blacklisted");
            }
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get blacklist information for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "blacklist"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }

        int blacklisted = myResponse.getInt("blacklisted");
        System.out.println("Success. Domain is: " + (blacklisted == 1 ? "Blacklisted" : "Not blacklisted"));

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. We will get screenshot for the domain name “whoapi.com”.

<?php
// Prepare vars
$fullurl    = "whoapi.com";     // page url
$r          = "screenshot";     // request type
$apikey     = "demokey";        // your API key
$process    = "thumb";          // thumb image only (first viewport without scroll)
$resolution = "1366x768";       // screen resolution to use

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com?apikey=$apikey&r=$r&fullurl=$fullurl&process=$process&resolution=$resolution&asap=&node_geo=&delay=&thumbwidth=&thumbheight=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Small thumbnail for \"$fullurl\": ".$output['thumbnail_https'];
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We will get screenshot for the domain name “whoapi.com”.

<script type="text/javascript">
var fullurl    = "whoapi.com";            // page url
var r          = "screenshot";            // request type
var apikey     = "demokey";               // your API key
var process    = "thumb";                 // thumb image only (first viewport without scroll)
var resolution = "1366x768";              // screen resolution to use

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com?apikey='+apikey+'&r='+r+'&fullurl='+fullurl+'&process='+process+'&resolution='+resolution+'&asap=&node_geo=&delay=&thumbwidth=&thumbheight=', true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Small thumbnail: " + json.thumbnail_https;
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We will get screenshot for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

fullurl    = "whoapi.com";            # page url
r          = "screenshot";            # request type
apikey     = "demokey";               # your API key
process    = "thumb";                 # thumb image only (first viewport without scroll)
resolution = "1366x768";              # screen resolution to use

output = JSON.parse(URI.open("https://api.whoapi.com?apikey=#{apikey}&r=#{r}&fullurl=#{fullurl}&process=#{process}&resolution=#{resolution}&asap=&node_geo=&delay=&thumbwidth=&thumbheight=").read)

if output["status"].to_i == 0
 puts "Success. Small thumbnail: " + output["thumbnail_https"]
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We will get screenshot for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(fullurl, r, apikey, process, resolution) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        fullurl=fullurl,
        r=r,
        apikey=apikey,
        process=process,
        resolution=resolution))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Small thumbnail: " + data["thumbnail_https"])
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


fullurl = 'whoapi.com'      # page url
r = 'screenshot'            # request type
apikey = 'demokey'          # key
process = "thumb";          # thumb image only (first viewport without scroll)
resolution = "1366x768";    # screen resolution to use

whoapi_request(fullurl, r, apikey, process, resolution)

Objective C

We will get screenshot for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *fullurl    = @"whoapi.com";         // page url
    NSString *r          = @"screenshot";         // request type
    NSString *apikey     = @"demokey";            // your API key
    NSString *process    = @"thumb";              // thumb image only (first viewport without scroll)
    NSString *resolution = @"1366x768";           // screen resolution to use
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?fullurl=%@&r=%@&apikey=%@&process=%@&resolution=%@", fullurl, r, apikey, process, resolution];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Small thumbnail: %@", responseDictionary[@"thumbnail_https"]);
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We will get screenshot for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "screenshot"; // request type
        string fullurl = "whoapi.com"; // page url
        string apiKey = "demokey"; // api key
        string process = "thumb"; // thumb image only (first viewport without scroll)
        string resolution = "1366x768"; // screen resolution to use

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?fullurl={0}&r={1}&apikey={2}&process={3}&resolution={4}", fullurl, apiType, apiKey, process, resolution));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine(String.Format("Success. Small thumbnail: {0}. ", json["thumbnail_https"]));
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get screenshot for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String fullurl = "whoapi.com"; // page url
        String rtype = "screenshot"; // request type
        String apikey = "demokey"; // your API key
        String process = "thumb"; // thumb image only (first viewport without scroll)
        String resolution = "1366x768"; // screen resolution to use

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?fullurl=" + fullurl + "&r=" + rtype + "&apikey=" + apikey + "&process=" + process + "&resolution=" + resolution);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }
        
        String thumbURL = myResponse.getString("thumbnail_https");
        
        System.out.println("Success. Small thumbnail: " + thumbURL);
        
      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Coming Soon!

Javascript

Coming Soon!

Ruby

Coming Soon!

Python

Coming Soon!

Objective C

Coming Soon!

C#(.NET)

Coming Soon!

Java

Coming Soon!

PHP

Basic PHP example using cURL. We will get GEO information for the domain name “whoapi.com”.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "geo";            // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" GEO country is: ".$output['geo_country'];
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We will get GEO information for the domain name “whoapi.com”.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "geo";             // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain GEO country is: " + json.geo_country;
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We will get GEO information for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "geo"          # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain GEO country is: " + output["geo_country"]
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We will get GEO information for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain GEO country is: " + data['geo_country'])
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'geo'               # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We will get GEO information for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"geo";            // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Domain GEO country is: %@", responseDictionary[@"geo_country"]);
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We will get GEO information for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "geo"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine(String.Format("Success. Domain GEO country is: {0}. ", json["geo_country"]));
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get GEO information for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "geo"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }

        String country = myResponse.getString("geo_country");
        System.out.println("Success. Domain GEO country is: " + country);

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. First, we will send email “goran@whoapi.com” for the scoring.

<?php
// Prepare vars
$email     = "goran@whoapi.com";    // email to check
$r         = "emailscore";          // request type
$apikey    = "demokey";             // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?email=$email&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Email \"$email\" was sent for the scoring.";
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Second, we will request the scoring result.

<?php
// Prepare vars
$email     = "goran@whoapi.com";    // email to check
$r         = "emailscore-check";    // request type
$apikey    = "demokey";             // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?email=$email&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    // The result is not yet ready
    if (!isset($output['results'][0]['overall_score'])) {
        echo "Success. Email \"$email\" is not yet scored. Try again later.";
    } else {
        echo "Success. Email \"$email\" was scored: ".$output['results'][0]['overall_score'];
    }
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

First, we will send email “goran@whoapi.com” for the scoring.

<script type="text/javascript">
var email      = "goran@whoapi.com";      // email you want to check
var r          = "emailscore";            // request type
var apikey     = "demokey";               // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?email='+email+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Email was sent for the scoring.";
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Second, we will request the scoring result.

<script type="text/javascript">
var email      = "goran@whoapi.com";        // email you want to check
var r          = "emailscore-check";        // request type
var apikey     = "demokey";                 // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?email='+email+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            // The result is not yet ready
            if (!json?.results[0]?.overall_score) {
                document.getElementById("result").innerHTML = "Success. Email is not yet scored. Try again later";
            } else {
                document.getElementById("result").innerHTML = "Success. Email was scored: " + json.results[0].overall_score;
            }
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

First, we will send email “goran@whoapi.com” for the scoring.

require 'open-uri'
require 'json'

email      = "goran@whoapi.com"     # email to check
r          = "emailscore"           # request type
apikey     = "demokey"              # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?email=#{email}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Email was sent for the scoring."
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Second, we will request the scoring result.

require 'open-uri'
require 'json'

email      = "goran@whoapi.com"     # email to check
r          = "emailscore-check"     # request type
apikey     = "demokey"              # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?email=#{email}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 if output["results"][0]["overall_score"].nil?
  puts "Success. Email is not yet scored. Try again later"
 elsif
  puts "Success. Email was scored: " + output["results"][0]["overall_score"].to_s
 end
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

First, we will send email “goran@whoapi.com” for the scoring.

#!/usr/bin/env python
import requests


def whoapi_request(email, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        email=email,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Email was sent for the scoring.")
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


email = 'goran@whoapi.com'   # email to check
r = 'emailscore'             # request type
apikey = 'demokey'           # key

whoapi_request(email, r, apikey)

Second, we will request the scoring result.

#!/usr/bin/env python
import requests


def whoapi_request(email, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        email=email,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            if data["results"][0]["overall_score"] is None:
                print("Success. Email is not yet scored. Try again later")
            else:
                print("Success. Email was scored: " + str(data["results"][0]["overall_score"]))
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


email = 'goran@whoapi.com'   # email to check
r = 'emailscore-check'       # request type
apikey = 'demokey'           # key

whoapi_request(email, r, apikey)

Objective C

First, we will send email “goran@whoapi.com” for the scoring.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *email    = @"goran@whoapi.com";   // email to check
    NSString *r        = @"emailscore";         // request type
    NSString *apikey   = @"demokey";            // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?email=%@&r=%@&apikey=%@", email, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Email was sent for the scoring.");
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

Second, we will request the scoring result.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *email    = @"goran@whoapi.com";  // email to check
    NSString *r        = @"emailscore-check";  // request type
    NSString *apikey   = @"demokey";           // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?email=%@&r=%@&apikey=%@", email, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                if (responseDictionary[@"results"][0][@"overall_score"] == nil)
                {
                    NSLog(@"Success. Email is not yet scored. Try again later\n");
                } else {
                    NSLog(@"Success. Email was scored: %@", responseDictionary[@"results"][0][@"overall_score"]);
                }
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

First, we will send email “goran@whoapi.com” for the scoring.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "emailscore"; // request type
        string email = "goran@whoapi.com"; // email to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?email={0}&r={1}&apikey={2}", email, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine("Success. Email was sent for the scoring.");
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Second, we will request the scoring result.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "emailscore-check"; // request type
        string email = "goran@whoapi.com"; // email to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?email={0}&r={1}&apikey={2}", email, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            if (json["results"][0]["overall_score"].Type == JTokenType.Null)
            {
                Console.WriteLine("Success. Email is not yet scored. Try again later");
            }
            else
            {
                Console.WriteLine(String.Format("Success. Email was scored: {0}. ", json["results"][0]["overall_score"]));
            }
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

First, we will send email “goran@whoapi.com” for the scoring.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String email = "goran@whoapi.com"; // email to check
        String rtype = "emailscore"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?email=" + email + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }
        
        System.out.println("Success. Email was sent for the scoring.");
        
      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

Second, we will request the scoring result.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
import org.json.JSONArray;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String email = "goran@whoapi.com"; // email to check
        String rtype = "emailscore-check"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?email=" + email + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }
        
        JSONArray results = myResponse.getJSONArray("results");
        
        if (results.getJSONObject(0).isNull("overall_score")) {
          System.out.println("Success. Email is not yet scored. Try again later");
        } else {
          int overallScore = results.getJSONObject(0).getInt("overall_score");
          System.out.println("Success. Email was scored: " + overallScore);
        }

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. We will get DNS information for the domain name “whoapi.com”.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "dnszone";        // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" nameservers are: ".join(", ", $output['nameservers']);
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We will get DNS information for the domain name “whoapi.com”.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "dnszone";         // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain nameservers are: " + json.nameservers.join(", ");
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We will get DNS information for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "dnszone"      # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain nameservers are: " + output["nameservers"].join(", ")
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We will get DNS information for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain nameservers are: " + ','.join(data["nameservers"]))
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'dnszone'           # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We will get DNS information for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"dnszone";        // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSString *serversList = [responseDictionary[@"nameservers"] componentsJoinedByString:@","];
                NSLog(@"Success. Domain nameservers are: %@", serversList);
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We will get DNS information for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "dnszone"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine(String.Format("Success. Domain nameservers are: {0}. ", String.Join(",", json["nameservers"])));
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get DNS information for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.CDL;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "dnszone"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }

        JSONArray nameservers = myResponse.getJSONArray("nameservers");
        String result = CDL.rowToString(nameservers);
        System.out.println("Success. Domain nameservers are: " + result);

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. We will get IP whois information for the domain name “whoapi.com”.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "ipwhois";        // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    echo "Success. Domain \"$domain\" IP organization name is: ".$output['Organization'];
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We will get IP whois information for the domain name “whoapi.com”.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "ipwhois";         // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain IP organization name is: " + json.Organization;
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We will get IP whois information for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "ipwhois"      # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain IP organization name is: " + output["Organization"]
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We will get IP whois information for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain IP organization name is: " + data["Organization"])
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'ipwhois'           # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We will get IP whois information for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"ipwhois";        // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Domain IP organization name is: %@", responseDictionary[@"Organization"]);
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We will get IP whois information for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "ipwhois"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine(String.Format("Success. Domain IP organization name is: {0}. ", json["Organization"]));
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get IP whois information for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "ipwhois"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }

        String organization = myResponse.getString("Organization");
        System.out.println("Success. Domain IP organization name is: " + organization);

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}

PHP

Basic PHP example using cURL. We will get SSL certificate information for the domain name “whoapi.com”.

<?php
// Prepare vars
$domain    = "whoapi.com";     // domain to check
$r         = "cert";           // request type
$apikey    = "demokey";        // your API key

// API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.whoapi.com/?domain=$domain&r=$r&apikey=$apikey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);

// Success
if (isset($output['status']) && $output['status'] == 0) {
    if (!empty($output['certondomain'])) {
        echo "Success. Domain \"$domain\" SSL certificate issuer: ".$output['issuer'];
    } else {
        echo "Success. Domain \"$domain\" has no SSL certificate";
    }
    
// API error
} elseif (!empty($output['status_desc'])) {
    echo "API reports error: ".$output['status_desc'];
    
// Unknown error
} else {
    echo "Unknown error";
}
?>

Javascript

We will get SSL certificate information for the domain name “whoapi.com”.

<script type="text/javascript">
var domain     = "whoapi.com";      // domain name you want to check
var r          = "cert";            // request type
var apikey     = "demokey";         // your API key

var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://api.whoapi.com/?domain='+domain+'&r='+r+'&apikey='+apikey, true);
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        if (json.status == 0) {
            document.getElementById("result").innerHTML = "Success. Domain SSL certificate issuer: " + json.issuer;
        } else {
            document.getElementById("result").innerHTML = "API reports error: " + json.status_desc;
        }
    } else {
        document.getElementById("result").innerHTML = "Unknown error";
    }
};
xhr.send();
</script>
<div id="result">please wait..</div>

Ruby

We will get SSL certificate information for the domain name “whoapi.com”.

require 'open-uri'
require 'json'

domain     = "whoapi.com"   # domain to check
r          = "cert"         # request type
apikey     = "demokey"      # your API key

output = JSON.parse(URI.open("https://api.whoapi.com/?domain=#{domain}&r=#{r}&apikey=#{apikey}").read)

if output["status"].to_i == 0
 puts "Success. Domain SSL certificate issuer: " + output["issuer"]
elsif !output["status_desc"].nil?
 puts "API reports error: " + output["status_desc"]
else
 puts "Unknown error"
end

Python

We will get SSL certificate information for the domain name “whoapi.com”.

#!/usr/bin/env python
import requests


def whoapi_request(domain, r, apikey) -> None:

    res = requests.get('https://api.whoapi.com', dict(
        domain=domain,
        r=r,
        apikey=apikey))

    if res.status_code == 200:
        data = res.json()
        if int(data['status']) == 0:
            print("Success. Domain SSL certificate issuer: " + data["issuer"])
        else:
            print("API reports error: " + data['status_desc'])
    else:
        raise Exception('Unexpected status code %d' % res.status_code)


domain = 'whoapi.com'   # domain to check
r = 'cert'              # request type
apikey = 'demokey'      # key

whoapi_request(domain, r, apikey)

Objective C

We will get SSL certificate information for the domain name “whoapi.com”.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSString *domain   = @"whoapi.com";     // domain to check
    NSString *r        = @"cert";           // request type
    NSString *apikey   = @"demokey";        // your API key
    
    NSString *urlAsString = [NSString stringWithFormat:@
    "https://api.whoapi.com/?domain=%@&r=%@&apikey=%@", domain, r, apikey];
    
    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAsString]];
    [urlRequest setHTTPMethod:@"GET"];
    NSURLSession *session = [NSURLSession sharedSession];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
    {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            
            NSNumber *status;
            if([responseDictionary[@"status"] isKindOfClass:[NSString class]]) {
                NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
                f.numberStyle = NSNumberFormatterDecimalStyle;
                status = [f numberFromString:responseDictionary[@"status"]];
            } else {
                status = responseDictionary[@"status"];
            }
            if([status isEqualToNumber:@0])
            {
                NSLog(@"Success. Domain SSL certificate issuer: %@", responseDictionary[@"issuer"]);
            } else {
                NSLog(@"API reports error: %@", responseDictionary[@"status_desc"]);
            }
        }
        else
        {
            NSLog(@"Unexpected status code\n");
        }
        
        // Semaphore used only for the debug purpose
        dispatch_semaphore_signal(sema);
    }];
    [dataTask resume];
    
    // Semaphore used only for the debug purpose
    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    
    return 0;
}

C#(.NET)

We will get SSL certificate information for the domain name “whoapi.com”.

using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net;

public class Program
{
    public static void Main()
    {
        string apiType = "cert"; // request type
        string domain = "whoapi.com"; // domain to check
        string apiKey = "demokey"; // api key

        WebRequest request = WebRequest.Create(String.Format("https://api.whoapi.com/?domain={0}&r={1}&apikey={2}", domain, apiType, apiKey));
        WebResponse response = request.GetResponse();

        StreamReader reader = new StreamReader(response.GetResponseStream());
        string responseFromServer = reader.ReadToEnd();

        JObject json = JObject.Parse(responseFromServer);

        if (json.Value<int>("status") == 0)
        {
            Console.WriteLine(String.Format("Success. Domain SSL certificate issuer: {0}. ", json["issuer"]));
        }
        else
        {
            Console.WriteLine(String.Format("API reports error: {0}. ", json["status_desc"]));
        }
    }
}

Java

We will get SSL certificate information for the domain name “whoapi.com”.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;

class Main {
    public static void main(String args[]) {
      try {
        // Set data
        String domain = "whoapi.com"; // domain to check
        String rtype = "cert"; // request type
        String apikey = "demokey"; // your API key

        // Send request to API
        URL obj = new URL("https://api.whoapi.com/?domain=" + domain + "&r=" + rtype + "&apikey=" + apikey);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        
        // Validate HTTP response code
        int responseCode = con.getResponseCode();
        if (responseCode != 200) {
          System.out.println("HTTP request error, code: " + responseCode);
          return;
        }
        
        // Read API reply
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
        
        // Get JSON
        JSONObject myResponse = new JSONObject(response.toString());
        int status = myResponse.getInt("status");
        String statusDesc = myResponse.getString("status_desc");
        
        // Validate request status
        if (status != 0) {
          System.out.println("API reports error: " + statusDesc);
          return;
        }
        
        if (myResponse.has("certondomain") && myResponse.getBoolean("certondomain") == true) {
            String issuer = myResponse.getString("issuer");
            System.out.println("Success. Domain SSL certificate issuer: " + issuer);
        } else {
            System.out.println("Success. Domain has no SSL certificate");
        }

      } catch (Exception e) {
          e.printStackTrace();
      }
    }
}