标致软件下载

文章搜索: 分类 关键字
您的位置:首页精文荟萃建站交流 → 天气预报采集程序(asp)
天气预报采集程序(asp)
日期:2006-11-10 18:54:31      人气:0     [ ]
推荐去上面的下载地址下载,还有些晴,小雨等小图片。<BR>附代码:<BR><BR><BR><BR><BR>
<META content=默飞冲天 name=generator><BR>
<META content=默飞冲天 name=keywords><BR>
<STYLE type=text/css>body {font-family:&nbsp;&nbsp;Arial; font-size:&nbsp;&nbsp;12px;color: #000000;}td {font-family:&nbsp;&nbsp;Arial; font-size:&nbsp;&nbsp;12px;line-height:20px;}a:link,a:visited{text-decoration: none; color:&nbsp;&nbsp;#000000}a:hover {&nbsp;&nbsp;color:&nbsp;&nbsp;#ff0000; text-decoration: underline}</STYLE>
<BR><BR><BR><BR><%<br>
'制作:默飞<br>
'QQ:33224360<br>
'http://mofei.xinxiu.com<br>
'天气预报最新适用采集程序<br>
'声明取得目标信息的函数,通过XML组件进行实现。<br>
Function GetURL(url) <br>
Set Retrieval = CreateObject("Microsoft.XMLHTTP") <br>
With Retrieval <br>
.Open "GET", url, False<br>
.Send <br>
GetURL = bytes2bstr(.responsebody)<br>
'对取得信息进行验证,如果信息长度小于100则说明截取失败<br>
if len(.responsebody)<100 then<br>
response.write "获取远程文件 <a href="&url&" target=_blank>"&url&"</a> 失败。"<br>
response.end<br>
end if<br>
<br>
End With <br>
Set Retrieval = Nothing <br>
End Function<br>
' 二进制转字符串,否则会出现乱码的!<br>
function bytes2bstr(vin) <br>
strreturn = "" <br>
for i = 1 to lenb(vin) <br>
thischarcode = ascb(midb(vin,i,1)) <br>
if thischarcode < &h80 then <br>
strreturn = strreturn & chr(thischarcode) <br>
else <br>
nextcharcode = ascb(midb(vin,i+1,1)) <br>
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode)) <br>
i = i + 1 <br>
end if <br>
next <br>
bytes2bstr = strreturn <br>
end function <br>
'声明截取的格式,从Start开始截取,到Last为结束<br>
Function GetKey(HTML,Start,Last)<br>
filearray=split(HTML,Start)<br>
filearray2=split(filearray(1),Last)<br>
GetKey=filearray2(0)<br>
End Function<br>
<br>
Dim Softid,Url,Html,Title <br>
<br>
'把下面的[将乐]改成你的城市,就是你城市的天气预报了,可到www.tq121.com.cn里查一下,有没收录你的城市,一般到县级的都有。<br>
Url="http://weather.tq121.com.cn/detail.php?city=将乐" <br>
<br>
Html = GetURL(Url) <br>
'搜索要偷取的内容的开始位置<br>
Str_start = instr(Html, "预报发布时间")<br>
Str_start = instr(Str_start, Html, "<table width=""979"" height=""185"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">")<br>
<br>
'搜索要偷取的内容的结束位置<br>
Str_end = instr(Str_start, Html, "<table width=""979"" height=""105"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">")<br>
<br>
'截取内容<br>
Html = Mid(Html, Str_start, Str_end - Str_start)<br>
'调整表格<br>
Html=replace(replace(Html,"width=""979""","width=100%"),"height=""185""","") '大表格<br>
Html=replace(replace(Html,"width=""133""","width=95%"),"height=""183""","") '背景大小<br>
Html=replace(replace(Html,"width=""973""",""),"height=""183""","")<br>
Html=replace(replace(Html,"width=""113""","width=100%"),"height=""35""","") '日期表格<br>
Html=replace(replace(Html,"width=""57""",""),"width=""56""","") '图片表格<br>
Html=replace(replace(Html,"width=""50""",""),"height=""46""","")<br>
Html=replace(replace(Html,"height=""57""",""),"height=""73""","")<br>
Html=replace(Html,"width=""141""","width=14%") '表格分配<br>
Html=replace(Html,"width=""140""","width=14%")<br>
Html=replace(Html,"width=""139""","width=14%")<br>
Html=replace(Html,"width=""133""","width=16%")<br>
Html=replace(Html,"width=""125""","width=100%")<br>
Html=replace(Html,"width=""107""","width=100%")<br>
Html=replace(replace(Html,"../images/","images/"),"./images/","images/") '图片路径<br>
response.write Html<br>
<br>
'Response.Write"采集完毕!"<br>
%><BR><BR><BR>
出处:标致软件学院