###############################################################################
whois-api-client.php

A Simple Whois Client with Registrar API Support. 
Can be used from DomainPunch.Com Domain Name Management Products

Copyright (c) CodePunch Solutions

@author Anil Kumar <akumar@codepunch.com>
@link   https://codepunch.com

###############################################################################

This is a simple whois client, with registrar API support, that can be run 
from any web server to obtain domain details. You can also use this from 
various Domain Name Management Products available from DomainPunch.Com.

This is very useful in cases when you want to manage your own domain names, 
but can't access the port 43 whois data because of limitations set by the 
registrar.

The API will work only for domains registered under your authenticated profile 
of the supported registrars. In other cases the script will fall back to the 
default port 43 whois.

###############################################################################
API Support
###############################################################################

The Whois API Client script currently supports the the following registrar 
APIs.

1. GoDaddy
2. ResellerClub
3. Dynadot
4. Namecheap
5. DomainersDe
6. Internet.bs

We will add more registrar APIs soon.

Before you start, you will need to obtain the various API keys and configure 
the IP addresses that will connect to the API. You can do this from your 
registrar's web interface.

###############################################################################
Requirements
###############################################################################

Web Server, PHP 5.4 and above with Curl 

###############################################################################
Installation
###############################################################################

1. Download the ZIP file (whoisapi.zip) and unzip into a folder. Copy the 

   whois/config-sample.php

   file to config.php in the same folder and open it any text editor. Add the 
   various API keys obtained from your registrar.

2. Upload the entire contents to a web folder.

3. Access the script from a browser like so...

   https://yourdomain/path/web-api-client.php?d=example.com
   
   and check that it works.
   
4. Use it to lookup the domains you have registered at one of the API supported
   registrars. You can do this by specifying the default whois server for that
   registrar. For example,
   
   https://yourdomain/path/web-api-client.php?d=godaddy.com&s=whois.godaddy.com
   
   This will work only if the domain is registered at GoDaddy under your profile.
   If not, it will fall back to the default port 43 lookup.
   
5. You can enable a simple authentication to prevent unauthorized access to 
   your script by adding a key in the config.php file.

   For example, you can set

   $api_whois_access_key	= "bnRtwe78";

   and then access the URL as

   https://yourdomain/path/web-api-client.php?d=example.com&k=bnRtwe78

   Please use the script on an SSL enabled site if you are using a key. 
   
###############################################################################
Using the API Script in DomainPunch.Com products
###############################################################################
   
Once everything is working fine you can enable the proxy settings in
Domain Punch Pro or Watch My Domains by specifying the URL. This can be done 
in the 'App Settings' or for individual registrars.

If you are setting it up in the 'App Settings', please see

https://domainpunch.com/kb/registrarapi.php

You should specify the 'API Web CLient URL' entry as

https://yourdomain/path/web-api-client.php

or

https://yourdomain/path/web-api-client.php?k=xxxxx

where xxxxx is your authentication key.

If you are using it for individual whois servers, you can specify the URL
as the http proxy entry in Whois Setup. You will also have to add the
's' parameter. 

For example, for whois.godaddy.com, the proxy URL will be

https://yourdomain/path/web-api-client.php?d={D}&s=whois.godaddy.com

The application (Domain Punch Pro / Watch My Domains) will replace the {D} with
the actual domain name when the URL is invoked.

You can also use s=GoDaddy, as in

https://yourdomain/path/web-api-client.php?d={D}&s=GoDaddy

It is better to use the whois server as the 's' parameter because the script
will be able to default to the normal port 43 whois if the registrar API
call fails for any reason.

Please see the KB articles at DomainPunch.Com for more details. 

https://domainpunch.com/kb/
   