⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stealclass.asp

📁 该程序包中附有“手机归属地查询接口_ASP版[v1.0.0910]”源码
💻 ASP
字号:
<%
'================================================================
' 本程序供学习交流之用,可以自由转载免费使用;转载时请保留如下信息:
' 发布网站:http://www.hi5360.com	网站名称:电子商务之家·hi5360.com
' Copyright (C) 2008 HI5360.COM All Rights Reserved.
' ===============================================================

Class clsSteal

Private src_      '采集的目标URL
Private prm_      '传入的POST或GET参数
Private enc_	  '字符编码
Private value_    '采集的内容
private sub class_initialize()
	src_=""
	prm_=""
	enc_="GB2312"
	value_=""
end sub

public property let src(str)
	src_=str
end property

public property let rqst(str)
	prm_=str
end property

public property let enc(str)
	enc_=str
end property

public property get value
	value=value_
end property

public sub send(pMethod)	
	if src_="" then 
	value_="src属性不能为空"
	exit sub
	end if
		
	On Error Resume Next
    	dim Http
	set Http=server.createobject("MSXML2.XMLHTTP")
	if UCase(pMethod)="POST" then
	Http.open "POST",src_ ,false
	Http.setRequestHeader "Content-Length",Len(prm_)
	Http.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"	
	Http.send(prm_)
	else
	Http.open "GET",src_ ,false
	Http.send()
	end if

	if Http.readystate<>4 then exit sub
	
	value_=BytesToBSTR(Http.responseBody)
	value_=lcase(value_)	
	set http=nothing
	if err.number<>0 then err.Clear	
end sub

private function BytesToBstr(body)
	dim oSTM
	set oSTM = Server.CreateObject("adodb.stream")
	oSTM.Type = 1
	oSTM.Mode =3
	oSTM.Open
	oSTM.Write body
	oSTM.Position = 0
	oSTM.Type = 2
	oSTM.Charset = enc_
	BytesToBstr = oSTM.ReadText 
	oSTM.Close
	set oSTM = nothing
end function

public sub cut(strBeg,strEnd)
	iH=instr(lcase(value_) , strBeg)
	iB=instr(lcase(value_) , strEnd)
	if iH>0 and iB>0 then value_=mid(value_ , iH+len(strBeg), iB-iH-len(strEnd))
end sub

public sub exch(strOld,strNew)
	value_=replace(value_ , strOld, strNew)
end sub

end class
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -