mardi 20 janvier 2015

IP data lookup - C#

Okay, so I've googled on several occasions regarding this, but each one suggests respectfully decent choices like : "Selenium" which works fine, but isn't use-able without firefox (or even within an API to my knowledge?).


I have this code :



public byte[] GetFileViaHttp(string url)
{
using (WebClient client = new WebClient())
{
return client.DownloadData(url);
}
}


Then I also have this code :



byte[] result = GetFileViaHttp(@"http://ip-lookup.net/");
string str = Encoding.UTF8.GetString(result);
richTextBox1.Text = str;


Works fine, returns my IP's information, but I want to automate this with other IP addresses, rather than return my own. How would this be done ? By this I mean, I want the API to take txtBox1.Text (IP) & print the details into richTextBox1.Text (Host/Country) ..


How could this be done ?


Aucun commentaire:

Enregistrer un commentaire