Option Explicit
Dim XmlHttp As Object
Dim RegExp As Object
Dim WebCode As String
Dim PostData As StringPrivate Sub Command1_Click()
If Text1.Text = "" Or Len(Text1.Text) < 7 Then MsgBox "请输入手机号,最少7位数!": Exit Sub
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
Set RegExp = CreateObject("VBscript.RegExp")
PostData = "number=" & Text1.Text
XmlHttp.Open "POST", "http://cx.shouji.360.cn/hao", False
XmlHttp.setRequestHeader "Referer", "http://cx.shouji.360.cn/hao"
XmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XmlHttp.setRequestHeader "Content-Length", Len(Text1.Text)
XmlHttp.send (PostData)
WebCode = XmlHttp.responseText
RegExp.Pattern = "city" + Chr(34) + ">(.*)</div></td>[\s\S]*?" & "type" + Chr(34) + ">(.*)</div></td>"
Label1.Caption = RegExp.Execute(WebCode)(0).SubMatches(0) & RegExp.Execute(WebCode)(0).SubMatches(1)
Set XmlHttp = Nothing
Set RegExp = Nothing
End SubPrivate Sub Text1_Change()
If Check1.Value = 1 Then
If Len(Text1.Text) = 7 Then Command1.Value = True
If Len(Text1.Text) < 7 Then Label1.Caption = ""
End If
End Sub
Dim XmlHttp As Object
Dim RegExp As Object
Dim WebCode As String
Dim PostData As StringPrivate Sub Command1_Click()
If Text1.Text = "" Or Len(Text1.Text) < 7 Then MsgBox "请输入手机号,最少7位数!": Exit Sub
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
Set RegExp = CreateObject("VBscript.RegExp")
PostData = "number=" & Text1.Text
XmlHttp.Open "POST", "http://cx.shouji.360.cn/hao", False
XmlHttp.setRequestHeader "Referer", "http://cx.shouji.360.cn/hao"
XmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XmlHttp.setRequestHeader "Content-Length", Len(Text1.Text)
XmlHttp.send (PostData)
WebCode = XmlHttp.responseText
RegExp.Pattern = "city" + Chr(34) + ">(.*)</div></td>[\s\S]*?" & "type" + Chr(34) + ">(.*)</div></td>"
Label1.Caption = RegExp.Execute(WebCode)(0).SubMatches(0) & RegExp.Execute(WebCode)(0).SubMatches(1)
Set XmlHttp = Nothing
Set RegExp = Nothing
End SubPrivate Sub Text1_Change()
If Check1.Value = 1 Then
If Len(Text1.Text) = 7 Then Command1.Value = True
If Len(Text1.Text) < 7 Then Label1.Caption = ""
End If
End Sub
解决方案 »
- vb怎么查找文件,并统计出符合条件的个数
- 数据库查询 对象Refresh的方法 IAdodc失败
- 帮看看 这句话有什么错误 我实在是看不错来了
- 如何使使用richtextbox控件的文档不需要重新引用控件?
- 急急急------高分求简单问题:VB调用ORACLE的存储过程,分不够可以再加
- 如何获得通过VBA打开的文件的显示窗口FORM对象?
- 很实际的问题看一看对谁都有好处!!!
- 为什么我在系统托盘上的右键弹出菜单,一旦弹出后,就一定得选一个菜单后才能消失,而不象其它程序,只要在菜单外面点一点,菜单就消失了
- 谁能给我“Shockwave Flash控件”我?或者给个下载地址!!!!!
- 有关vb创建类的属性的问题
- 哪有合适win7的vb软件下啊?
- 我想在VB6.0中借用VBA代码完成下拉列表框的填充,但不能通过,请高手修改
post里要提交编码或压缩方式
改成这样试一试!