生成靜態頁面

<%  
  Set   xml   =   Server.CreateObject("Microsoft.XMLHTTP")  
  '把下面的地址替換成你的首頁的文件地址,一定要用http://開頭的絕對路徑,不能寫相對路徑  
  xml.Open   "GET",   "http://www.baidu.com/index.asp",   False  
  xml.Send      
  BodyText=xml.ResponseBody  
  BodyText=BytesToBstr(BodyText,"gb2312")  
  Set   xml   =   Nothing  
  Dim   fso,   MyFile    
  Set   fso   =   CreateObject("Scripting.FileSystemObject")  
  Set   MyFile=   fso.CreateTextFile(server.MapPath("index.html"),   True)  
  MyFile.WriteLine(BodyText)  
  MyFile.Close  
   
   
  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  
  %>

發佈了138 篇原創文章 · 獲贊 9 · 訪問量 102萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章