正 文

用XMlhttp生成html页面


www.7dspace.com  更新日期:2005-8-17 4:04:23  七度空间


<%'定义xmlhttp
function GetXmlText(Url)
dim GetXmlHttp

set GetXmlHttp=server.Createobject("Microsoft.XMLHTTP")
GetXmlHttp.open "Get",url,false,"",""
GetXmlHttp.Send
'GetXmlText=GetXmlHttp.Responsetext
GetXmlText=GetXmlHttp.ResponseBody
set GetXmlHttp=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

'保存文件
Sub SaveToFile(strBody,File)
    Dim objStream
    Set objStream = Server.CreateObject("ADODB.Stream")
    With objStream
        .Type = 2
        .Open
        .Charset = "GB2312"
        .Position = objStream.Size
  .WriteText = strBody
        .SaveToFile Server.MapPath(File),2
        .Close
    End With
    Set objStream = Nothing
End Sub
%>

<% SaveFile BytesToBstr(GetXmlText("http://127.0.0.1/index.asp"),"GB2312"),"index.htm"%>


上一篇:ASP无组件BMP汉字生成类+汉字点阵库
下一篇:服务器端改XML冲突的解决方法讨论
作者:  来源:本站整理 ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐