<% On Error Resume Next server.scripttimeout=9999999 Function 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 = Nothing End Function Function newstring (WSTR,STRNG) Newstring=instr (LCase (WSTR), LCase (STRNG)) If Newstring<=0 then Newstring=len (WSTR) End Function %> <% Dim wstr,str,url,start,over,city City = request.querystring ("id") Url= "http://cn.finance.yahoo.com/q?s=USDKRW=X&d=c" Wstr=gethttppage (URL) Start=newstring (WSTR, "last Transaction") Over=newstring (WSTR, "buyer bid") Body=mid (Wstr,start,over-start) Start2=instr (Body, "<b>") +3 Over2=instr (Body, "</b>") Body2=mid (BODY,START2,OVER2-START2) Response.Write Body2 %>
|