How to get information of your ip : domain to lookup

For getting the information from the ip of server or our local system, There is a api for that in which the api proider gives the information related to ip.

For Example : if you need to the location information of client or end user ip than use below code.

Also if you want the DNS information of the ip than you need to use below api.

So you will get the below output :

2 thoughts on “How to get information of your ip : domain to lookup

  1. Hello jitendra khunt,
    This is amazing trick !
    I am testing this code in my local wamp server and it is not working because $_SERVER[‘REMOTE_ADDR’] is set to 127.0.0.1. ? So I think I need external IP for my PC. Any hint ? Waiting for your replay….

    1. See here $_SERVER[‘REMOTE_ADDR’] this gives your machine ip to server. $_SERVER[‘REMOTE_ADDR’] this give the ip of the machine to the server that make the request. and by using an opensource api we can define the location for that machine ip.

      In your case your server is localhost – your machine so definitely ip is 127.0.0.1 so you will get information about your machine and if you not get any information for your local machine than it means you knows your machine location.

Leave a Reply

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