Find Country from URI
First Add the Service reference : http://www.webservicex.com/geoipservice.asmx?WSDL
IPAddress[] address = Dns.GetHostAddresses(textBox1.Text);
string[] array =new string[address.Count()];
int i=0;
foreach (IPAddress item in address)
{
array[i] = item.ToString();
}
textBox2.Text = array[0].ToString();
ServiceReference1.GeoIPServiceSoapClient cl = new ServiceReference1.GeoIPServiceSoapClient();
ServiceReference1.GeoIP gp =
cl.GetGeoIP(array[0].ToString());
textBox3.Text = gp.CountryName + " : " + gp.CountryCode;
Comments
Post a Comment