Overview

Namespaces

  • whoisServerList

Classes

  • WhoisApi

Exceptions

  • RecoverableWhoisApiException
  • WhoisApiException
  • Overview
  • Namespace
  • Class

Class WhoisApi

A Whois API.

This is a client library for the service of http://whois-api.domaininformation.de/. Register there to get an API key.

With this API you can check if a domain name is available, get its whois data or query an arbitrary whois server. The service is using the whois list from https://github.com/whois-server-list/whois-server-list. Also it avoids hitting any rate limits on the whois servers.

Example:

use whoisServerList\WhoisApi;

$whoisApi = new WhoisApi("apiKey");
echo $whoisApi->isAvailable("example.net") ? "available" : "registered";
Namespace: whoisServerList
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Whois API
Located at WhoisApi.php
Methods summary
public
# __construct( string $apiKey, string $endpoint = "https://whois-v0.p.mashape.com/" )

Builds a Domain API.

Builds a Domain API.

Register at http://whois-api.domaininformation.de/ to get an API key.

Parameters

$apiKey
API key
$endpoint
optional endpoint, default is "https://whois-v0.p.mashape.com/".
public boolean
# isAvailable( string $domain )

Checks if a domain is available.

Checks if a domain is available.

If a domain is available (i.e. not registered) this method will return true.

Parameters

$domain
domain name, e.g. "example.net"

Returns

boolean
true if the domain is available, false otherwise.

Throws

whoisServerList\RecoverableWhoisApiException

API failed, but you can try again. This can happen if the upstream whois server did not respond in time.


whoisServerList\WhoisApiException
API failed
public boolean[]
# areAvailable( array $domains )

Checks multiple domains if they are available.

Checks multiple domains if they are available.

areAvailable(["example.net", "example.org", "example.com"]) could return this map:

[
  "example.net" => true,  // example.net is available
  "example.org" => false, // example.org is registered
  "example.com" => null   // example.com failed
]

Parameters

$domains
domain names, e.g. ["example.net", "example.org"]

Returns

boolean[]

map with the result for each domain. True means the domain is available, false not. NULL however means that the query failed for that domain.

public string
# whois( string $domain )

Returns the whois data for a domain.

Returns the whois data for a domain.

Parameters

$domain
domain name, e.g. "example.net"

Returns

string
response of the respective whois server

Throws

whoisServerList\RecoverableWhoisApiException

API failed, but you can try again. This can happen if the upstream whois server did not respond in time.


whoisServerList\WhoisApiException
API failed
public string
# query( string $host, string $query )

Queries a whois server.

Queries a whois server.

Parameters

$host
hostname of the whois server, e.g. "whois.verisign-grs.com"
$query
query, e.g. "example.net"

Returns

string
response from the whois server

Throws

whoisServerList\RecoverableWhoisApiException

API failed, but you can try again. This can happen if the upstream whois server did not respond in time.


whoisServerList\WhoisApiException
API failed
public string[]
# domains( )

Returns a list of all top and second level domains, which are known to the Whois API.

Returns a list of all top and second level domains, which are known to the Whois API.

Returns

string[]
all available top and second level domains.
API documentation generated by ApiGen