View Single Post
Old 21.04.2006, 06:12   #13
RipperX
Архивный участник
 
Join Date: Dec 2005
Posts: 242
Default

Quote:
Originally Posted by Digital
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>";
}
The code is totally fine, that can't be wrong. Works fine 4 me.
Add me to ur messenger and we will see how to fix this sh*t.

bb
RipperX is offline