我通过程序读取网页内容 只有几行 而我右键点‘7天’按钮旁空白处 显示源代码 出来代码很多 我就不知道该如何能读到那个代码 lin:='http://www.t7online.com/China/Chengdu.htm'; with IdHTTP1.Request do begin ContentType :='application/x-www-form-urlencoded'; UserAgent :='Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)'; end;
with IdHTTP1.Request do
begin
ContentType :='application/x-www-form-urlencoded';
UserAgent :='Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)';
end;
try
MyStr1:=IdHttp1.Get(lin); except
Showmessage('网络出错!');
Exit;
end;
showmessage(mystr1);
把src= 后边的网面地址 用idhttp去Get得到的就是你想要的东西啦...
下面是显示出来的代码
<link rel="canonical" href="http://www.t7online.com/China/Chengdu.htm">
</head>
<frameset cols="10,800,*" border="0" frameborder="0" framespacing="0">
<frame src="http://wodas.t7online.com/static/wo_leftsky.htm" name="cntlinks" noresize scrolling="no" marginwidth="0" marginheight="0">
<frameset rows="90,30,*" border="0" frameborder="0" framespacing="0">
<frame src="http://wodas.t7online.com/dynamic/wo_bf.fcgi?LANG=cn&KONT=cncn&LAND=CI&WMO=56294&ORTN=成都" noresize scrolling="no" name="werbung" marginwidth="0" marginheight="0">
<frame src="/cncn_akt.htm" noresize scrolling="no" marginwidth="0" marginheight="0">
<frameset cols="150,*" border="0" frameborder="0" framespacing="0">
<frame src="/include/cncn_region_vor.htm" scrolling="auto" name="linke_leiste" noresize marginwidth="0" marginheight="0">
<frame src="/cgi-bin/region?PRG=citybild&CONT=cncn&CREG=hkch&WMO=56294&LAND=CI&LANG=cn" scrolling="auto" name="WOcontent" noresize marginwidth="0" marginheight="0">
</frameset>
</frameset>
<frame src="http://wodas.t7online.com/dynamic/wo_sky.fcgi?LANG=cn&KONT=cncn&LAND=CI&WMO=56294&ORTN=成都" name="cntrechts" noresize scrolling="no" marginwidth="0" marginheight="0">
</frameset>
</html>
http://weather.xcyh.org/
各种格式,自己喜欢看着办
fhttp.Get('http://www.t7online.com/China/Chengdu.htm',stream);
//得到/cgi-bin/region?PRG=citybild&CONT=cncn&CREG=hkch&WMO=56294&LAND=CI&LANG=cn fhttp.Request.Referer:= 'http://www.t7online.com/China/Chengdu.htm';
str:= fhttp.Get('http://www.t7online.com/cgi-bin/region?PRG=citybild&CONT=cncn&CREG=hkch&WMO=56294&LAND=CI&LANG=cn');
//得到/cgi-bin/citybild?WMO=56294&LANG=cn&BKM=Sichuan/Chengdu&SID=b
//在这个URL后边加上 '#citydetail_window' 就是你想要的路径 str:= fhttp.Get('http://www.t7online.com/cgi-bin/citybild?WMO=56294&LANG=cn&BKM=Sichuan/Chengdu&SID=b'+ '#citydetail_window');//这里就得到你所需要的页面容了。。 这个地址是固定的吧。 应该不是动态变的
fhttp.Get('http://www.t7online.com/China/Chengdu.htm',stream);
//得到/cgi-bin/region?PRG=citybild&CONT=cncn&CREG=hkch&WMO=56294&LAND=CI&LANG=cn fhttp.Request.Referer:= 'http://www.t7online.com/China/Chengdu.htm';
str:= fhttp.Get('http://www.t7online.com/cgi-bin/region?PRG=citybild&CONT=cncn&CREG=hkch&WMO=56294&LAND=CI&LANG=cn');
//得到/cgi-bin/citybild?WMO=56294&LANG=cn&BKM=Sichuan/Chengdu&SID=b
//在这个URL后边加上 '#citydetail_window' 就是你想要的路径 str:= fhttp.Get('http://www.t7online.com/cgi-bin/citybild?WMO=56294&LANG=cn&BKM=Sichuan/Chengdu&SID=b'+ '#citydetail_window');
fhttp.Get('http://www.t7online.com/China/Chengdu.htm',stream);
改为
str:= fhttp.Get('http://www.t7online.com/China/Chengdu.htm');
就可以了