<%
const incFilePath = "f:\xml\" '包含文件所在目录,最后的\号是必须的
const logfile = "d:\club-job-log.txt" '日志文件
const incWeather = "GetWh.htm" '包含文件所在目录,最后的\号是必须的
dim fs
dim f
on error resume next
Set fs = CreateObject("Scripting.FileSystemObject")
dim wstr
wstr=getHTTPPage("http://202.106.103.44/forecast/fc06024.php")
'Response.Write wstr
wstr=right(wstr,len(wstr)-instr(wstr,"<MAP name=Map>")+1)
wstr=replace(wstr,"fc06024.php","")
wstr1="<HTML><style>td,body{font-size:9pt}</style><body leftmargin=0 topmargin=0 >"
wstr1=wstr1 & "<DIV id=overDiv style=""Z-INDEX: 1; POSITION: absolute""></DIV>"
wstr1=wstr1 & "<SCRIPT language=JavaScript1.1 src=""tojava.js""></SCRIPT>"
wstr1=wstr1 & wstr
wstr1=wstr1 & "<IMG src=""chinamapzj.gif"" width=559 useMap=""#Map"" border=0>"
wstr1=wstr1 & "</body></html>"
Response.Write wstr1
if err.number=0 then
Set f = fs.CreateTextFile(incFilePath & incWeather,true)
f.write wstr1
set f = nothing
else
wscript.echo err.description
end if
set fs = nothing
Sub writeLog(Msg)
On Error Resume Next
Dim f
Set f = fs.OpenTextFile(logfile,8,true)
f.WriteLine now & " - " & Msg
f.close
End Sub
function getHTTPPage(url)
on error resume next
dim http
set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function