【www.gdgbn.com--php常用代码】

提供一款asp,xmlhttp实现的手机号码归属地查询源码哦,你可以看看这款代码是不是适合你哦,好了费话不说多了来看看吧。
Class clsSteal

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

private sub class_terminate()
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
%>


<%
Dim mySTL,outstr,url,vPost,vMethod
Dim aryText "//文本数据
Dim aStr,vHTML
vPost=Request.Form("hiCode")

set mySTL=new clsSteal
mySTL.src="http://www.hi5360.com/open/Tool1.0.asp?t=mobile&c="&vPost
mySTL.send("GET")
aryText=mySTL.value
Set mySTL=nothing

response.write("
 现,采集的字符串数据为 “" &Replace(aryText,"","$")& "
" )
response.write("
 今,转化成数组后的各项数据如下:")
aStr=Split(aryText,"")
For i=0 To UBound(aStr)-1
 vHTML=vHTML& "
  [" &i& "] " &aStr(i)& ""
Next
response.write(vHTML)

%>





  
手机号码段  
<%=aStr(0)%> 
 

卡号归属地<%=aStr(1)%>


卡类型<%=aStr(2)%>


区 号<%=aStr(3)%>


邮 编<%=aStr(4)%>

站长更多常用工具在线查询

收录查询 | Alexa查询 | 域名注册查询 | Whois查询 | IP地址查询 | PR查询 | 天气预报查询 | 模仿蜘蛛 | 友情链接查询

站长常用工具下载

seo查询工具 其它工具 PR查询 IP地址查询 Whois查询 域名注册查询 Alexa排名查询 收录查询 上传软件 操作系统安装文件 推扩软件 WEB编辑器

本文来源:http://www.gdgbn.com/jiaocheng/20084/