Deepak Ranjan Jena Deepak Ranjan Jena - 5 months ago 34
PHP Question

How to get country name from IP address in php

I want to find country, city, latitude and longitude from IP address using php. I am using this url and it is returning data in xml format.

http://www.ipgp.net/api/xml/122.163.6.58

The data is coming like this:

<IpLookup>
<Ip>122.163.6.58</Ip>
<Code>IN</Code>
<Country>India</Country>
<Flag>http://www.ipgp.net/flags/in.png</Flag>
<City>Calcutta</City>
<Region>West Bengal</Region>
<Isp></Isp>
<Lat>22.5697</Lat>
<Lng>88.3697</Lng>

</IpLookup>


Can anybody suggest how to parse and get the result

Answer
Comments