使用XMLhttp生成html页面

时间:2007-08-17 11:21:00 

本文介绍了使用XMlhttp技术来生成html页面,值得借鉴。相关函数:


<% 
’定义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  
%> 


使用方法:


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


标签:XML,XMLhttp,html
0
投稿

猜你喜欢

  • SQL查询效率注意事项小结

    2012-01-05 19:31:25
  • Oracle SQL性能优化系列学习三

    2010-07-23 13:08:00
  • Magic Photo Frame 神奇创意相框

    2009-09-15 20:45:00
  • asp的access数据库备份 压缩 恢复及清理数据库函数

    2008-10-31 12:36:00
  • CSS背景图片的运用优化HTTP连接数

    2008-09-04 21:38:00
  • 保安的故事

    2009-12-28 13:02:00
  • 使用Title提升可访问性

    2009-04-04 17:06:00
  • MySQL (root@%) does not exist的问题

    2011-03-16 15:31:00
  • ASP Crazy 模版操作类(最简单的模板类、仅提供交流)

    2011-03-17 11:06:00
  • 一个NumericStepper组件

    2010-01-22 15:46:00
  • 悟道Web标准:让W3C标准兼容终端

    2009-10-11 16:40:00
  • 带你轻松接触MaxDB和MySQL之间的协同性

    2008-12-03 17:10:00
  • asp如何用HtmlEncode来显示Unicode编码?

    2010-06-12 12:49:00
  • 段正淳的css笔记(4)css代码的简写

    2007-11-01 22:03:00
  • “尊重”设计师?

    2009-03-23 18:14:00
  • JS完美实现对象克隆

    2008-08-03 16:51:00
  • 在MySQL中获得更好的全文搜索结果

    2008-05-09 10:38:00
  • 价值3亿美元的按钮[译]

    2009-03-18 19:39:00
  • 完美解决MySQL中文乱码

    2011-03-16 15:16:00
  • 理清mysql外链的含义和命令

    2010-03-09 15:55:00
  • asp之家 网络编程 m.aspxhome.com