注册 登录
编程论坛 ASP技术论坛

[已解决]我用这个函数获取html代码,为什么采集的页面更新了,我采的代码没更新呢?

hellode 发布于 2008-08-18 16:59, 1116 次点击
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False
.Send
GetURL = bytes2bstr(.responsebody)
'对取得信息进行验证,如果信息长度小于100则说明截取失败
if len(.responsebody)<100 then
response.write "获取远程文件 <a href="&url&" target=_blank>"&url&"</a> 失败。"
response.end

end if
End With
Set Retrieval = Nothing
End Function
' 二进制转字符串,否则会出现乱码的!
function bytes2bstr(vin)
strreturn = ""
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
strreturn = strreturn & chr(thischarcode)
else
nextcharcode = ascb(midb(vin,i+1,1))
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
i = i + 1
end if
next
bytes2bstr = strreturn
end functio非n

[[it] 本帖最后由 hellode 于 2008-8-21 11:38 编辑 [/it]]
5 回复
#2
hellode2008-08-19 11:37
我的意思是说,要被采的页面更新了,而我采下来的却没有更新!
#3
hellode2008-08-20 10:45
楼上的是垃圾!
#4
hellode2008-08-21 10:54
自个解决了,因为xmlhttp中,使用,你用同一个网址,他会自动调用以前存起来的html代码

只要在,http://www.这样的后面搞个随机参数就OK,例如:
http://www.?100
#5
wxr99992008-08-21 18:42
学习了
1