|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Option Explicit
- Public Function GetInfo(strnum As String)
- Dim xmlhttp As Object
- Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
- xmlhttp.Open "get", "http://www.tiantianxieye.com/nub/" & strnum & ".html", False
- xmlhttp.setRequestHeader "If-Modified-Since", "0"
- xmlhttp.send
-
- Do While xmlhttp.readystate <> 4
- DoEvents
- Loop
-
- Dim strResult As String
- strResult = StrConv(xmlhttp.responseBody, vbUnicode)
-
- Dim RegEx As Object
- Set RegEx = CreateObject("VBScript.RegExp")
- Dim match As Object
-
-
- RegEx.Global = True
- RegEx.ignorecase = True
- RegEx.Pattern = "卡号归属地:</SPAN><SPAN class=T>(.+?)</SPAN>[\s\S]+?卡号类型[\s\S]+?class=T>(.+?)</"
-
- If RegEx.Test(strResult) Then
-
- Dim matchs As Object
- Set matchs = RegEx.Execute(strResult)
-
- Dim arr(1 To 2)
-
- For Each match In matchs
- arr(1) = match.submatches(0)
- arr(2) = match.submatches(1)
- Next
- End If
- Debug.Print arr(1), arr(2)
- End Function
复制代码
|
|