I need to find out the user's country, tried via geoplugin.net , but there is xml code, how to read it I do not know.
URL oracle = new URL("http://www.geoplugin.net/xml.gp?ip=xx.xx.xx.xx");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
This code outputs
<?xml version="1.0" encoding="UTF-8"?>
<geoPlugin>
<geoplugin_request>91.xxx.118.xx</geoplugin_request>
<geoplugin_status>206</geoplugin_status>
<geoplugin_delay>1ms</geoplugin_delay>
<geoplugin_credit>Some of the returned data includes GeoLite data created by MaxMind, available from <a href='http://www.maxmind.com'>http://www.maxmind.com</a>.</geoplugin_credit>
<geoplugin_city></geoplugin_city>
<geoplugin_region></geoplugin_region>
<geoplugin_regionCode></geoplugin_regionCode>
<geoplugin_regionName></geoplugin_regionName>
<geoplugin_areaCode></geoplugin_areaCode>
<geoplugin_dmaCode></geoplugin_dmaCode>
<geoplugin_countryCode>RU</geoplugin_countryCode>
<geoplugin_countryName>Russia</geoplugin_countryName>
<geoplugin_inEU>0</geoplugin_inEU>
<geoplugin_euVATrate></geoplugin_euVATrate>
<geoplugin_continentCode>EU</geoplugin_continentCode>
<geoplugin_continentName>Europe</geoplugin_continentName>
<geoplugin_latitude>55.7386</geoplugin_latitude>
<geoplugin_longitude>37.6068</geoplugin_longitude>
<geoplugin_locationAccuracyRadius>1000</geoplugin_locationAccuracyRadius>
<geoplugin_timezone>Europe/Moscow</geoplugin_timezone>
<geoplugin_currencyCode>RUB</geoplugin_currencyCode>
<geoplugin_currencySymbol>&#1088;&#1091;&#1073;</geoplugin_currencySymbol>
<geoplugin_currencySymbol_UTF8>руб</geoplugin_currencySymbol_UTF8>
<geoplugin_currencyConverter>66.0003</geoplugin_currencyConverter>
</geoPlugin>
I need to get the contents of the string <geoplugin_countryName>Russia</geoplugin_countryName>