各维度大神,我想问下,在winform中使用www.ip138.com的查询接口(http://www.ip138.com/ip2city.asp)为什么程序提示“远程服务器返回错误: (403) 已禁止”。
具体代码是这样的
string url = "http://www.ip138.com/ip2city.asp";//实际上到这一句的时候已经异常了,异常原因就是上面说的那个
string post = "ip=" + ipAddress + "&action=2";
string response = client.UploadString(url, post);难道是ip138的这个接口封了?还有其他的解决办法吗,,,,,我的是winform的,不是web的
貌似腾讯的接口 http://fw.qq.com/ipaddress 也返回不了数据
具体代码是这样的
string url = "http://www.ip138.com/ip2city.asp";//实际上到这一句的时候已经异常了,异常原因就是上面说的那个
string post = "ip=" + ipAddress + "&action=2";
string response = client.UploadString(url, post);难道是ip138的这个接口封了?还有其他的解决办法吗,,,,,我的是winform的,不是web的
貌似腾讯的接口 http://fw.qq.com/ipaddress 也返回不了数据
string url = "http://www.ip138.com/ips138.asp?ip=" + PostIp + "&action=2";
System.Net.HttpWebRequest req138 = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
req138.Method = "GET";
System.Net.HttpWebResponse res138 = (System.Net.HttpWebResponse)req138.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(res138.GetResponseStream(), System.Text.Encoding.Default);
string backstr = sr.ReadToEnd();
sr.Close();
res138.Close();