![]() |
|
|
#12 |
|
Архивный участник
Join Date: Nov 2004
Posts: 1,405
|
well.. it doesnt work :S
same problem persist... this is my code... // Send the request and hopefully we'll get response. // Try to parse out the IP address from the returned HTML try { //http://dynupdate.no-ip.com/ip.php //http://www.whatismyip.com //http://www.getmyipaddress.com //http://checkip.dyndns.org //http://ripper.net.ar/ip.php WebRequest myRequest = WebRequest.Create("http://ripper.net.ar/ip.php"); myRequest.Timeout = 320000; // Send request, get response, and parse out the IP address on the page. //HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); using (WebResponse res = myRequest.GetResponse()) { using (Stream s = res.GetResponseStream()) using (StreamReader sr = new StreamReader(s, Encoding.UTF8)) { string html = sr.ReadToEnd(); Regex regex = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"); string ipString = regex.Match(html).Value; return ipString; } } } catch (Exception ex) { string a = ex.Message; return "<Unable to resolve>"; } |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|