<%
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,"最後交易")
over=newstring(wstr,"买方出价")
body=mid(wstr,start,over-start)
start2=instr(body,"<b>")+3
over2=instr(body,"</b>")
body2=mid(body,start2,over2-start2)
response.write body2
%>
