private void page_load(object sender, system.eventargs e)
{
webrequest wreq=webrequest.create("http://weather.yahoo.com/forecast/chxx0133_c.html");
httpwebresponse wresp=(httpwebresponse)wreq.getresponse();
string html ="";
stream s=wresp.getresponsestream();
streamreader objreader = new streamreader(s,system.text.encoding.getencoding("gb2312"));
string sline = "";
int i = 0;
while (sline!=null)
{
i++;
sline = objreader.readline();
if (sline!=null)
html += sline;
}
string temp= "";
int start,stop;
// string aa="<div class=/"five-day-forecast night/" style=/"border:none;/">";
//string aa="<div class=/"five-day-forecast/" style=/"border:none;/">";
string aa="<table><th>today</th>";
start = html.indexof(aa,0,html.length);
stop = html.indexof("</table>",start)+8;
temp = html.substring(start, stop - start);
this.weather2.text=temp;
string cc="<tr class=/"titles/"><td>";
//
int aa1 =temp.indexof(cc,0,temp.length);
int bb=temp.indexof("</td>",aa1);
this.weather2.text=temp.substring(aa1, bb - aa1).tostring();
string ee="<tr class=/"temps/">";
int aa2 =temp.indexof(ee,0,temp.length);
int bb1=temp.indexof("</td>",aa2);
this.label1.text=temp.substring(aa2, bb1 - aa2).tostring();
// 在此处放置用户代码以初始化页面
}
新闻热点
疑难解答
图片精选