以后地位:首页 > 建站常识 > 列表

asp获得长途网页的指定内容的实古代码

点击: 次时候:2016/12/8关头词:asp 长途网页 xmlhttp
'用ASP获得长途方针网页指定内容On Error Resume Next Server.ScriptTimeOut=9999999 Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=Bytes

asp获得长途网页的指定内容的实古代码

'用ASP获得长途方针网页指定内容On Error Resume Next Server.ScriptTimeOut=9999999 Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=BytesToBstr(t,"GB2312") End function Function Newstring(wstr,strng) Newstring=Instr(lcase(wstr),lcase(strng)) if Newstring<=0 then Newstring=Len(wstr) 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 GetBody(url) on error resume next Set Retrieval = CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "Get", url, False, "", "" .Send GetBody = .ResponseBody End With Set Retrieval = Nothing End Function 'ASP获得长途网页指定内容起头 Dim wstr,str,url,start,over,dtime a="起头内容" 'ASP获得方针网页内容起头标记 b="竣事内容" 'ASP获得网页内容竣事标记 url="http://127.0.0.1/index.html" wstr=getHTTPPage(url) start=Newstring(wstr,a) over=Newstring(wstr,b) body=mid(wstr,start,over-start) response.write ""&body&"" '输出获得到的网页内容 'ASP获得长途网页指定内容竣事 
预定建站
收费供给网站优化
支付关头词