Static generation method of dynamic website homepage

xiaoxiao2021-03-06  14

method one

<%

'Common Function' 1, Enter the URL Target Web Address, Return Value Gethttppage is the HTML code for the target web page Function gethttppage (URL) DIM httpset http = server.createObject ("msxml2.xmlhttp") http.open "get", URL, Falsehttp .send () if http.readyState <> 4 THEN EXIT functionEND IFTHTTTPPAGE = BYTESTOBSTR (http.responsebody, "gb2312") set http = Nothingif 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 Hemma, can convert Function Bytestobstr (Body, Cset) DIM ObjStreamSet Objstream = Server.createObject ("AdoDb.Stream Component) Dim Objstreamset Objstream = Server.createObject ") objstream.Type = 1objstream.Mode = 3objstream.Openobjstream.Write bodyobjstream.Position = 0objstream.Type = 2objstream.Charset = CsetBytesToBstr = objstream.ReadText objstream.Closeset objstream = nothingEnd 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 that there is no established openFile own. WriteLine (Stext) Set OpenFile = Nothing

%>