The method of using xmlhttp to obtain web page content under asp is generally more general, and then intercepts the content of the web page through characters.
Copy the code as follows:url=http://www.csdn.net/
wstr=getHTTPPage(url)
start=Newstring(wstr,Resource Selection<!-- Download-->)
over=Newstring(wstr,<div class =friendlink>)
body=mid(wstr,200,500)
response.write body
Function getHTTPPage(url)
dim objXML
set objXML=createobject(MSXML2.XMLHTTP)'define
objXML.open GET,url,false'Open
objXML.send()'Send
If objXML.readystate<>4 then 'Determine whether the document has been parsed, so that the client can accept the return message
exit function
End If
getHTTPPage=bBytesToBstr(objXML.responseBody)' returns information and uses function definition encoding
set objXML=nothing'Close
if err.number<>0 then err.Clear
End Function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr )
End Function
Function bBytesToBstr(body)
dim objstream
set objstream = CreateObject(adodb.stream)
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = gb2312
'Convert the original default UTF-8 encoding to GB2312 encoding, otherwise directly use XMLHTTP to call the web page with Chinese characters. will be gibberish
bBytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
end Function
Function BytesToBstr(body)
dim objstream
set objstream = CreateObject(adodb.stream)
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = utf-8
'Convert the original default UTF-8 encoding to GB2312 encoding, otherwise directly using XMLHTTP to call a webpage with Chinese characters will result in garbled code
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
end Function