The code copy is as follows:
<%
'======================================================
classEngineerSearch
'Laolong:[email protected]
': Simulate XML to obtain http tag resources (you will know why XML is useful after using it :))
'Use engine search (displays engine information or information on its hyperconnected website or directly related information on a specified page, using regular and xmlHttp,
'The use of the program needs to construct regularity)
'---------------------------------------------------------------
privateoReg, oxmlHttp'A regular, a Microsoft xmlhttp
'---------------------------------------------------------------
publicsubclass_initialize()' object creation trigger
setReg=newregExp
oReg.Global=true
oReg.IgnoreCase=true
setoXmlHttp=server.createobject("Microsoft.XmlHttp")
endsub
'---------------------------------------------------------------
publicsubclass_terminate()' object destruction triggers
setReg=nothing'The self-built object in the class must be manually released, and asp will only automatically release the objects defined by the class.
setoXmlHttp=nothing
Iftypename(tempReg)<>"nothing"then' method releases resources in the object in the body
settempReg=nothing
endif
endsub
'---------------------------------------------------------------
'Engine level search
publicfunctionengineer(url,EngineerReg)
'Function introduction: Obtain the return information of the url (usually used for engine search), extract the specific information of the EngineerReg, and return the matches collection to
'Function name. Obtain the url query results, search for the results defined by the engineerReg regularity, and generate a matches collection.
'Since it is impossible to create a collection and operate the number of sets (vbscript), it is best to traverse the set yourself, or consider a two-dimensional array
dimstrConent
strContent=oXmlHttp.open("get",url,false)
onerrorresumenext
oXmlHttp.send()
iferr.number<>0then
exitfunction
endif
strContent=bytes2BSTR(oXmlHttp.responseBody)
ifisnull(EngineerReg)then
engineer=AbsoluteURL(strContent,url)
else
oReg.Pattern=EngineerReg
setengineer=oReg.Execute(AbsoluteURL(strContent,url))
endif
endfunction
'---------------------------------------------------------------
'Chinese character encoding, (online person)
publicFunctionbytes2BSTR(vIn)
strReturn=""
Fori=1ToLenB(vIn)
ThisCharCode=AscB(MidB(vIn,i,1))
IfThisCharCode<&H80Then
strReturn=strReturn&Chr(ThisCharCode)
Else
NextCharCode=AscB(MidB(vIn,i+1,1))