来自页面whatismyipaddress.com的网页回复 [英] Web response from page whatismyipaddress.com

查看:144
本文介绍了来自页面whatismyipaddress.com的网页回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我确实收到了whatismyipaddress.com的回复,但今天我再次测试并得不到回应。

我正在使用此代码:

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:

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.

推荐答案

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



为什么要为单个变量使用数组语法,以及<的值是多少? code> i 表达式 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

string i_S = "http://whatismyipaddress.com/";
WebRequest iZ = WebRequest.Create(i_S);


这篇关于来自页面whatismyipaddress.com的网页回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆