网络编程 
首页 > 网络编程 > 浏览文章

提供几个关于采集的函数(ASP)

(编辑:jimmy 日期: 2025/12/4 浏览:3 次 )

<%
''''''''''''''''断剑注释'''''''''''''''''''''''''
''''strText为要切取内容的那段打的内容''''''''''''
''''strStarTag为要切取内容的开始的地方''''''''''
''''strEndTag为要切取内容的结束的地方''''''''''
''''GetText返回值为切取出来的内容''''''''''''''
'''''''''''''''注释结束''''''''''''''''''''''''
Function GetText(strText, strStartTag, strEndTag)
dim intStart
intStart = instr(strText, strStartTag)
if intStart then
intStart = intStart + len(strStartTag)
intEnd = InStr(intStart, strText, strEndTag)
GetText = Mid(strText, intStart, intEnd - intStart)
else
GetText = " "
end if
End Function

%>
<%
'''''''''断剑注释''''''''''''
'''''''''以下的函数都可以不管'''''''''
''''''''只管入口函数getHTTPPage'''''''
''''''''path为要读取的网页地址''''''''
''''''''getHTTPPage返回读取到的网页内容''
''''''''这里应该注意的是gb2312这里,如果被读取的网页编码是
''gb2312就用gb2312,如果是UTF-8的话,就换成UTF-8''''
''''''''注释结束''''''''''
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"gb2312")
End function

Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>

上一篇:ASP小偷(远程数据获取)程序的入门教程
下一篇:如何采集静态文章系统
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 站点导航 SiteMap