Grab the web page. I have to realize the real renewal weather forecast. Use the XMLHTTP components to grab the specified section of the web page.
Need part of HTML source code
The captured HTML source code in this case is as follows
Tuesday, August 24, 2004; Day: Sunny, Time, Yunnan Wind 3-4; Night: Sunny South Wind 3-4; Temperature: Maximum 29 ° C Minimum 19 ° C P>
And the program is from
Search with keywords on August 24, 2004 until P>
The content of the capture becomes "Tuesday, August 24, 2004; day: sunny, more than the clouds 3-4; night: sunny South wind 3-4; temperature: up 29 ° C minimum 19 ° C"
It's clean. Record.
<%
ON Error ResMe next
Server.scripttimeout = 9999999
Function gethttppage (PATH)
T = getBody (PATH)
gethttppage = Bytestobstr (t, "GB2312")
END FUNCTION
Function GetBody (url) on error resume next Set Retrieval = CreateObject ( "Microsoft.XMLHTTP") With Retrieval .Open "Get", url, False, "", "" .Send GetBody = .ResponseBody End With Set Retrieval = Nothing End FUNCTION
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 = nothingEnd FunctionFunction Newstring (wstr, strng) Newstring = Instr (lcase (wstr), lcase (strng)) if Newstring <= 0 then Newstring = Len (wstr) End Function%>
<% DIM WSTR, STR, URL, START, OVER, DTIMEDTIME = Year (Date) & "Year" & Month (Date) & Day (Date) & "Japan" URL = "http://www.qianhuaWeb. COM / "WSTR = gethttppage (URL) Start = Newstring (WSTR, DTIME) OVER = Newstring (WSTR," P> ") Body = MID (WSTR, START, OVER-Start) Response.write"
%> body> html>