原文網址:利用asp擷取網頁資料
如何利用ASP抓取網頁資料並且顯示中文的問題,有興趣的歡迎參考:
<%@ language=VBScript%> Get HTML Source Code - Copyright (C) Dhandapani Ammasai Enter a URL:
<% dim objXMLHTTP URL = Request.form("URL") if ( URL = "" ) then URL = "http://tw.yahoo.com/" end if Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") objXMLHTTP.Open "GET", URL, false objXMLHTTP.Send strTmp = bytesToBSTR(objXMLHTTP.responseBody,"big5") Response.Write "
" Response.Write "
HTML Code for "&URL&"
" Response.Write "" Set objXMLHTTP = Nothing 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 %>
留言列表