Static generation method of dynamic website homepage

xiaoxiao2021-03-06  43

Method 1% 'Common Function' 1, Enter the URL Target Web Address, Return Value GetHttppage is the HTML code for the target web page Function gethtppage (URL) DIM HTTP set http = server.createObject ("msxml2.xmlhttp") http.open "Get ", URL, FALSE http.send () if http.readyState <> 4 THEN EXIT FUNCTION END IF GETHTTPPAGE = BYTESTOBSTR (http.responsebody," gb2312 ") set http = Nothing if Err.Number <> 0 Then Err.clear end Function '2, conversion of Chambar, directly using the web page with Chinese characters with Chinese characters will be inormar, convert Function Bytestobstr (Body, Cset) Dim objstream set objstream = Server.createObject ("adodb component via AdoDb.Stream components) 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 txtURL = server.MapPath ( "../ index.asp") sText = getHTTPPage (txtURL) Set FileObject = Server.CreateObject ( "Scripting.FileSystemObject") filename = "../ index.htm" Set openFile = FileObject.OpenTextfile (Server.Mappath (FileName), 2, True) 'true is an OpenFile.writeline (Stext) set openfile = NO Thing%>