asp 文件采集代码

asp 文件采集代码
我们用到xmlhttp来抓取远程服务器文件的内容再把它转换成相关编码
<%
Function getHTTPPage(Path)
        t = GetBody(Path)
        getHTTPPage=BytesToBstr(t,"UTF-8")
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("ado"&"db.str"&"eam")
        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
%>

时间: 2024-07-30 23:32:43

asp 文件采集代码的相关文章

asp图片采集代码

称来判断图片是否存在, 判断远程图片是否存在,原理是利用XMLHTTP.status来判断 function CheckURL(byval A_strUrl) set XMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") XMLHTTP.open "HEAD",A_strUrl,false XMLHTTP.send() CheckURL=(XMLHTTP.status=200) set XMLHTTP = nothin

在aspx中能不能够调用asp文件或者代码?

问题描述 我的网站是用aspx做的但是论坛是用asp做的,我现在想在网站的首页中调用论坛的贴子,我该怎么样在首页调用! 解决方案 解决方案二:A.aspx中<IFRAMEID=IFrame1width="100px"height="100px"FRAMEBORDER=0SCROLLING=NOSRC="a.asp"></IFRAME>做好A.asp注意:A.asp的连接最好弹出新窗口_blank解决方案三:不用框架行不行?

asp 防采集代码

Dim AppealNum,AppealCount AppealNum=10 '同一IP60秒内请求限制10次 AppealCount=Request.Cookies("AppealCount") If AppealCount="" Then response.Cookies("AppealCount")=1 AppealCount=1 response.cookies("AppealCount").expires=datea

asp 防采集代码 二

user_agent=Request.ServerVariables("HTTP_USER_AGENT") http_reffer=Request.ServerVariables("HTTP_REFERER") server_name=Request.ServerVariables("SERVER_NAME") '检查当前用户是否是蜘蛛人 function check(user_agent) allow_agent=split("Bai

asp采集代码示例

下面是一侧ASP采集页面内容最基础的必备源代码,修改以下的代码需要有一定的ASP基础. 以下是引用片段:< %  '功能:asp采集代码  '作者:wangsdong  '备注:支持原创程序,请保留此信息,谢谢  url="http://sports.sina.com.cn/k/2008-09-15/04593948756.shtml"  str=getHTTPPage(url)  title=strcut(str,"<h1 id=""arti

简单的asp采集代码教程_小偷/采集

采集开始 第一步是分析要采集的页面. 使用浏览器打开要采集的页面(如:http://sports.sina.com.cn/k/2008-09-15/04593948756.shtml,你可以其他页面),打开后,点击右键,查源文件. 第二步,找到要采集的内容所在位置. 假如我要采集这个页面上的标题和内容所在的位置: 标题在<h1 id="artibodyTitle" style="color:#03005C;">和</h1>之间 内容在<

一段ASP防采集的代码

采集 一段ASP防采集的代码<%        '作用:文字防复制乱码 函数        'Date:2006-3-6        '作者:blue2004        '参数str 为原文,str1作者也是你自己,reslut产生乱码的种子        Function ReadToCode(str,Str1,result)                dim name                dim i,j,k                If isnull(str) th

asp.net中包含文件的代码及使用方法

  ASP.NET文件包含的方法基本与ASP文件包含差不多! 在ASP.NET包含文件的方法有: 1.<% Response.WriteFile("skin/default/footer.txt")%> 2.<% server.execute("skin/default/footer.txt")%> 3.StreamReader 对象将包含文件写到 HTTP 内容流中 //me:网上说asp.net中用include也可以的.. includ

asp FSO 读写文件本文件实现代码

 asp己经过时有一段时间了,我来讲述一下利用asp fso来实现文件读写操作,有需要学习的朋友可参考参考.   1.AtEndOfStream 该属性表明是否已到达整个文本文件末尾.其值为"TRUE"或"FALSE" 2.CreateTextFile 用来创建新的文本文件 3.OpenTextFile()方法中的参数 saucer(思归)所写的:  代码如下   Set f = fso.OpenTextFile("c:testfile.txt"