| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1112 人关注过本帖
标题:[已解决]我用这个函数获取html代码,为什么采集的页面更新了,我采的代码没 ...
只看楼主 加入收藏
hellode
Rank: 2
等 级:论坛游民
帖 子:161
专家分:16
注 册:2007-3-29
结帖率:80%
收藏
 问题点数:0 回复次数:5 
[已解决]我用这个函数获取html代码,为什么采集的页面更新了,我采的代码没更新呢?
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]]
搜索更多相关主题的帖子: 函数 html 代码 页面 采集 
2008-08-18 16:59
hellode
Rank: 2
等 级:论坛游民
帖 子:161
专家分:16
注 册:2007-3-29
收藏
得分:0 
我的意思是说,要被采的页面更新了,而我采下来的却没有更新!

[url=http://www./]鄂州大学DE校园论坛[url]
2008-08-19 11:37
hellode
Rank: 2
等 级:论坛游民
帖 子:161
专家分:16
注 册:2007-3-29
收藏
得分:0 
楼上的是垃圾!

[url=http://www./]鄂州大学DE校园论坛[url]
2008-08-20 10:45
hellode
Rank: 2
等 级:论坛游民
帖 子:161
专家分:16
注 册:2007-3-29
收藏
得分:0 
自个解决了,因为xmlhttp中,使用,你用同一个网址,他会自动调用以前存起来的html代码

只要在,http://www.这样的后面搞个随机参数就OK,例如:
http://www.?100

[url=http://www./]鄂州大学DE校园论坛[url]
2008-08-21 10:54
wxr9999
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-2-1
收藏
得分:0 
学习了

[url=www.]123[/url][url=www.]网页设计[/url]
2008-08-21 18:42
快速回复:[已解决]我用这个函数获取html代码,为什么采集的页面更新了,我采的代 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012056 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved