Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Few days ago, i did get the response from whatismyipaddress.com, but today i tested again and get no response.
I am using this code:
C#
string[] i_S = new string[1];
i_S[0] = "http://whatismyipaddress.com/";
WebRequest iZ = WebRequest.Create(i_S[i]);
using (WebResponse oI = iZ.GetResponse())
{
using (Stream stream = odgovorInterneta.GetResponseStream())
using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
{
string html = streamReader.ReadToEnd();
Regex regex = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"); 
string IPN = regex.Match(html).Value;                            
}
}

What could be the problem? I did use few more pages and from them i do get the response. Just from this one, i don't.
Posted
Updated 29-Apr-13 0:51am
v2
Comments
Mike Meinz 29-Apr-13 4:54am    
Better and faster help is available if you provide a small test example that we could copy and paste into our Visual Studio for testing. When you provide only a small section of your code, it is possible that the problem is elsewhere. A small test example that demonstrated the problem will help you resolve the problem quicker.
Bernhard Hiller 29-Apr-13 5:13am    
Do they have some policy for how often you can do that query per day?

1 solution

C#
string[] i_S = new string[1];
i_S[0] = "http://whatismyipaddress.com/";
WebRequest iZ = WebRequest.Create(i_S[i]);

Why are you using array syntax for a single variable, and what is the value of i in the expression WebRequest.Create(i_S[i])?

I suggest you rewrite it as
C#
string i_S = "http://whatismyipaddress.com/";
WebRequest iZ = WebRequest.Create(i_S);
 
Share this answer
 
Comments
Member 4347041 29-Apr-13 6:49am    
Because of no response i will use 3 of them:
string[] i_S = new string[3];
i_S[0] = "http://whatismyipaddress.com";
i_S[1] = "http://www.iplocation.net";
i_S[2] = "http://www.findmyip.org";
Richard MacCutchan 29-Apr-13 8:48am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900