Posted in: PHP, Tech-Byte

How To Check Host IP Address in PHP

How to check the Host IP address of a website or how to get Host IP of a Website. In this article i am going to tell you the function which we use for taking out the Host IP address or Host IP details. There are two methods which we will discuss here.

1. gethostbyname()

2. gethostbyaddr()

First we will get the Host IP address by entering the website name. Here we will use the gethostbyname() function.

It will show something like. – – This is the Host IP.

Now we will show the Host address from IP. We will use gethostbyaddr() function.

It will show you the Host name that is 

Note – gethostbyaddr() – Most of the time it will show you the different Host name if you check the IP of the website. Because it will show the Host IP. So dont get confused by this.

Leave a Reply

Your email address will not be published. Required fields are marked *