<%
Function GetPage(url)
dim RetrIEval
Set RetrIEval = CreateObject("Microsoft.XMLHTTP")
With RetrIEval
.Open "Get", url, False ', "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set RetrIEval = Nothing
End Function
Function BytesToBstr(body)
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 = "GB2312"
BytesToBstr = obJStream.ReadText
obJStream.Close
set obJStream = nothing
End Function
on error resume next
Url="http://www.taiang.com.cn/index.asp"
response.write "開始更新首頁..."
wstr = GetPage(Url)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
'if not MyFile.FolderExists(server.MapPath("/Html/")) then
'MyFile.CreateFolder(server.MapPath("/Html/"))'
'end if
If (fs.FileExists(server.MapPath("./")&"\index.htm")) Then
fs.DeleteFile(server.MapPath("./")&"\index.htm")
End If
Set CrFi=fs.CreateTextFile(server.MapPath("./")&"\index.htm")
Crfi.Writeline(wstr)
set CrFi=nothing
set fs=nothing
response.write "...<font color=red>更新完成!</font>"
%>