Simple PHP WHOIS Domain Lookup Script

This is simple PHP WHOIS script that you can understand easily. You can add advanced features to this script. This is a simple php whois script that can be easily understood. Here in this script I’ll be using only one server that is of .com domain.

You can use different whois servers, I’ve provided the list below in table format.

To get WHOIS data we should send data to WHOIS server with domain name and server port number.

Define the variables domain, whois server, port number. Port number is 43, you can use this for all whois servers.

Defining variables

I’m using .com domain, so I’m using only com whois server.

Fetching Domain WHOIS Data

First of all, we are connecting to server using fsockopen function. If it’s connected to server, we are getting the WHOIS data based on the domain name provided. Then after that we are storing this data in ouput variable.

Using this output variable we can output the domain WHOIS data.

Display the output on Screen

Use pre tags to display it in good format, if you are not using pre tags. Then the output is difficult to read.

Complete code of Simple WHOIS Script

Submit Domain Using Form

Here, I’m modifying above script into more dynamic form in a simple way, We will take the domain name and the extension thorough form instead of variables. And we will write code to select WHOS servers based on the selected domain extensions.

Add domain search form to HTML

Add this code into your PHP file, by adding this code we are inputting the domain through the form. To pass this domain variable we need to make changes to PHP code domain variable.

Modify the PHP Code

Here I’m making changes to send domain name input our code.

Add output code

Add this code, after the form in HTML.

Complete code with form

We can add features to this script like adding domain extensions select list field. Using this input etension we can selet the WHOIS server based on the extension.

WHOIS Servers List

TLDTypeCountryWHOIS Server

If you have any problem in implementing this script, let me know through the comment form below.

Incoming search terms:

  • username and password login coding in php
  • forgot paseord template using php
  • how to make login page in php
  • simple login with php
  • simple login rrgister code php
  • registration with connection in php
  • registration form php example
  • php simple login code
  • php 7 login code 2016
  • login register and forgot password php mysql scrip
Vivek Vengala

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: