<% On error resume nextserver.scripttimeout = 9999999function gethttppage (path) T = getBody (PATH) gethttppage = bytestobstr (t, "gb2312") End Function
Function bytes2BSTR (vIn) strReturn = "" For j = 1 To LenB (vIn) ThisCharCode = AscB (MidB (vIn, j, 1)) If ThisCharCode <& H80 Then strReturn = strReturn & Chr (ThisCharCode) Else NextCharCode = AscB (MidB (VIN, J 1, 1)) Strreturn = Strreturn & Chr (ClNG (thischarcode) * & H100 CINT (NEXTCHARCODE)) J = J 1 end if next bytes2bstr = Strreturn End Function
Function GetBody (url) on error resume next Set Retrieval = CreateObject ( "Microsoft.XMLHTTP") Retrieval.Open "Get", url, False, "", "" Retrieval.Send GetBody = Retrieval.responsebody 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, CITYCITY = Request.QueryString ("ID") URL = "http://cn.finance.yahoo.com/q?s=usdkrw=x&d=c" WSTR = Gethttppage (URL) Start = newstring (WSTR, "Final Trading") over = newstring (WSTR, "Buyer Bid") Body = MID (WSTR, START, OVER-START) Start2 = INSTR (Body, "") 3Over2 = INSTR (body, " b>") Body2 = MID (Body, Start2, Over2-Start2)
Response.write body2%>