<%
Function GetPage(url)
'获得文件内容
dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False ', "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
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 = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
on error resume next
Url="http://finance.yahoo.com/q?s=nine"'要读取的页面地址
'Url="http://custom.marketwatch.com/custom/firstrade/html-qcn.asp?calignment=center&symb=NINE"
wstr = GetPage(Url)
'response.write(wstr)
'交易时间
strFind1 = instr(1,wstr,"Trade Time:| ",1)+29
strFind3 = instr(strFind2,wstr," | | ",1)+8
strFind3 = instr(strFind2,wstr,"",1)
xmlGet1="Last Trade: "+mid(wstr,strFind2,strFind3-strFind2)+chr(13)+chr(10)
'涨跌
strFind1 = instr(1,wstr,"Change: | ",1)+29
strFind3 = instr(strFind2,wstr," |
| ",1)+29
strFind3 = instr(strFind2,wstr," |
| ",1)+29
strFind3 = instr(strFind2,wstr," |
1."&xmlGet0&" 2."&xmlGet1&" 3."&xmlGet2&" 4."&xmlGet3&" 5."&xmlGet4&" 6.其他..."
function bytes2bstr(vin)
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
response.write ""&xmlGet1&" "&xmlGet2&" "&xmlGet4&""
%>
|