コードコピーは次のとおりです。
<%
'=================================================================
ClassEngineersearch
'laolong:[email protected]
':XMLをシミュレートしてHTTPタグリソースを取得します(XMLが使用後に役立つ理由がわかります:))
'エンジン検索を使用します(エンジン情報または情報を、通常のページとXMLHTTPを使用して、指定されたページに直接関連する情報を表示します。
「プログラムの使用は規則性を構築する必要があります)
'-------------------------------------------------------------------------------------------------------------------------
privateoreg、oxmlhttp'aレギュラー、Microsoft xmlhttp
'-------------------------------------------------------------------------------------------------------------------------
publicsubclass_initialize() 'オブジェクト作成トリガー
setreg = newRegexp
oreg.global = true
oreg.ignorecase = true
setoxmlhttp = server.createObject( "microsoft.xmlhttp")
Endingub
'-------------------------------------------------------------------------------------------------------------------------
publicsubclass_terminate() 'オブジェクト破壊トリガー
setReg = nothingクラス内の自己構築オブジェクトは手動でリリースする必要があり、ASPはクラスによって定義されたオブジェクトを自動的にリリースするだけです。
setoxmlhttp =何もない
iftypename(tempreg)<> "Nothing" then 'メソッドはボディのオブジェクトのリソースをリリースします
setempreg =何もない
endif
Endingub
'-------------------------------------------------------------------------------------------------------------------------
'エンジンレベルの検索
publicFunctionEngineer(URL、EngineerReg)
'機能の紹介:URLの返品情報を取得し(通常はエンジン検索に使用されます)、EngineerRegの特定の情報を抽出し、Matchesコレクションを返します
'関数名。 URLクエリの結果を取得し、EngineerReg Regularityで定義された結果を検索し、Matches Collectionを生成します。
「コレクションを作成してセット数(VBScript)を操作することは不可能であるため、セットを自分でトラバースするか、2次元配列を検討することが最善です
薄暗い
strcontent = oxmlhttp.open( "get"、url、false)
onerrorresumenext
oxmlhttp.send()
iferr.Number <> 0then
exitFunction
endif
strcontent = bytes2bstr(oxmlhttp.responsebody)
Ifisnull(EngineerReg)
Engineer = absoluteurl(strcontent、url)
それ以外
oreg.pattern = EngineerReg
setEngineer = oreg.execute(absoluteurl(strcontent、url))
endif
エンド機能
'-------------------------------------------------------------------------------------------------------------------------
'漢字エンコーディング、(オンラインの人)
publicFunctionBytes2bstr(vin)
strreturn = ""
fori = 1tolenb(vin)
thischarcode = ascb(midb(vin、i、1))
ifthischarcode <&h80then
strreturn = strreturn&chr(thischarcode)
それ以外
NextCharcode = ascb(midb(vin、i+1,1))