Saturday, 15 December 2012

Add a Domain whois to your website using PHP

Want to add a domain whois to your site. Here is the step-by-step instruction I provide :

Difficulty level : Easy.

Prerequisite knowledge : PHP 5

  • A web server supporting PHP 5 or higher.
  • A google recaptcha account.


Step 1 : Get a Google Recaptcha for your site if you don't have one. 


Google Recaptcha is a global tool to stop spam. It is used in over 2 million sites to test if the application generating request is operated by Human or Program. This is very useful as a Robot or a Bot cannot interpret distorted text in a image.

If you are setting up a whois program on your website, it is absolutely necessary to add a Captcha to prevent spamming. If you have an account for your website then get the public and private keys directly from here.

If you don't have a account then follow these steps to get one :

  • If you are not logged it to your google account then Login.

  • Visit here and enter the domain name click create key.

    Add Domain Page

  • Now you will get the public and private key.

  • The keys in the image won't work. You need to get your own keys.

    Step 2 : Download the Zip file and extract the files

    • Download the whois package from here. It the link does not work visit

    • Extract all the files into folder "whois".


    Step 3 : Enter the Public and Private keys in the index.php file


    • Open index.php file in a simple text editor such as notepad or wordpad.

    • Replace the $publickey and $privatekey variable with the newly generated keys at google recaptcha site.

    • Save the file.


    Step 4 : Upload the files and test 


    • Upload the "whois" folder and all the files contained within it to the web server supporting PHP 5 or higher.

    • Visit your website from any browser Enter any domain name and test.

    • Done. The code is thoroughly tested and works well.

    You can add any changes you want to the webpage as you want to change its appearance.

    No comments:

    Post a Comment