抓取远程文件并保存到本地
来源:互联网 发布:网络数据安全 编辑:程序博客网 时间:2024/04/30 07:26
<%
****************************************************************************
PageName:GetRemoteFiles.asp
Function:Download the files to Server
Author:xiaotian
Last Modified at:2003-3-19
****************************************************************************
取得远程文件并保存到本地
Function GetRemoteFiels(RemotePath, LocalPath, FileName)
Dim strBody
Dim FilePath
On Error Resume Next
取得流
strBody = GetBody(RemotePath)
取得保存的文件名
if Right(LocalPath, 1) <> "/" then LocalPath = LocalPath & "/"
FilePath = LocalPath & GetFileName(RemotePath, FileName)
保存文件
if SaveToFile(strBody, FilePath) = true and err.Number = 0 then
GetRemoteFiles = true
else
GetRemoteFiles = false
end if
End Function
远程获取内容
Function GetBody(url)
Dim Retrieval
建立XMLHTTP对象
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
重组文件名
Function GetFileName(RemotePath, FileName)
Dim arrTmp
Dim strFileExt
arrTmp = Split(RemotePath, ".")
strFileExt = arrTmp(UBound(arrTmp))
GetFileName = FileName & "." & strFileExt
End Function
将流内容保存为文件
Function SaveToFile(Stream, FilePath)
Dim objStream
On Error Resume Next
建立ADODB.Stream对象,必须要ADO 2.5以上版本
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1 以二进制模式打开
objStream.Open
objstream.write Stream
objstream.SaveToFile FilePath, 2
objstream.Close()
关闭对象,释放资源
Set objstream = Nothing
if err.Number <> 0 then
SaveToFile = false
else
SaveToFile = true
end if
End Function
%>
- 抓取远程文件并保存到本地
- php抓取远程内容并保存到本地
- 取得远程文件并保存到本地
- 取得远程文件并保存到本地
- PHP抓取远程图片到本地保存
- 抓取远程图片保存到本地
- Java抓取文件保存到本地
- Java抓取文件保存到本地
- PHP抓取远程图片保存到本地的实现方法
- python抓取网页中图片并保存到本地
- python抓取网页中图片并保存到本地
- ASP.NET下载远程图片保存到本地的方法、保存抓取远程图片
- 使用XMLHttp和ADODB.Stream取得远程文件并保存到本地
- 使用XMLHttp和ADODB.Stream取得远程文件并保存到本地
- 使用XMLHttp和ADODB.Stream取得远程文件并保存到本地(转载)
- 抓取菜谱保存到本地
- 保存远程图片到本地并加水印
- php获取远程图片并下载保存到本地
- 由于系统缓冲区空间不足或列队已满,不能执行套接字上的操作。
- 每次启动数据库,连接时都提示Oracle initialization or shut down in progress
- 7种CSS圆角框解决方案
- 我的提高班学习状况_有感_04.02
- 用户 'NT AUTHORITY/NETWORK SERVICE' 登录失败
- 抓取远程文件并保存到本地
- B/S和C/S的区别
- HID ioctl 命令详解
- TextView 滚动如何实现
- linux常用的简单命令(三)tar、scp、df/du、ps、free、top、netstat、tcpdump、kill、reboot/halt/poweroff、shutdown
- 部分IT公司笔试算法题
- C#启动Windows服务及关闭实例实现
- How To: Assign a Macro to an ActiveX Control
- 开通交流平台