存档

文章标签 ‘asp’

利用xmlhttp生成html

2011年6月14日 robowang 没有评论
<%
dim moban,html
moban=”http://www.abc.com/aaa.asp
html=”../目录/文件名.html”
objhtml html,moban
function objhtml(path,str)’用xmlhttp生成
GetFold=split(path,”/”)
For e=0 to Ubound(GetFold)-1
    if fldr=”" then
        fldr=GetFold(e)
    else
        fldr=fldr&”/”&GetFold(e)
    end if
    If IsFolder(fldr)=false then
        CreateFolder fldr
    End if
Next
set objXmlHttp=Server.createObject(“Microsoft.XMLHTTP”)
objXmlHttp.open “GET”,str,false
objXmlHttp.send()
binFileData=objXmlHttp.responseBody
Set objXmlHttp=Nothing
set objAdoStream=Server.createObject(“ADODB.Stream”)
objAdoStream.Type=1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile Server.mapPath(path),2
objAdoStream.Close()
set objAdoStream=nothing
End function

Function IsFolder(Folder) ‘检测文件夹是否存在
    Set  objFSO  =  Server.CreateObject(“Scripting.FileSystemObject”)  
    If  objFSO.FolderExists(server.MapPath(Folder))  Then  
    IsFolder = True
    Else
    IsFolder = False
    End If
End Function
Function CreateFolder(fldr) ‘创建文件夹
    Dim fso, f
    Set fso = CreateObject(“Scripting.FileSystemObject”)
    Set f = fso.CreateFolder(Server.MapPath(fldr))
    CreateFolder = f.Path
    Set f=nothing
    Set fso=nothing
End Function
%>

分类: 网站代码 标签: ,