|
- Sub DoHttp()
- Dim Dom As Object, Http As Object, objWindow As Object
- Dim strURL As String, strText As String
- Set Http = CreateObject("MSXML2.XMLHTTP")
- Set Dom = CreateObject("htmlfile")
- strURL = "http://bzflh.szjs.gov.cn/TylhW/lhmcAction.do?method=queryYgbLhmcList"
- ReDim arr(1 To 10000, 0 To 10)
- With Http
- .Open "POST", strURL, False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .send "pageNumber=1&pageSize=10&waittype=2&num=0&shoulbahzh=&xingm=&idcard="
- strText = Split(Split(.responseText, "[")(1), "]")(0)
- End With
- R = Array("PAIX", "SHOULHZH", "XINGM", "SFZH", "RUHSJ", "SHOUCCBSJ_GZ", "QUA_DATE", "RZQK", "REMARK")
- With Dom.parentWindow
- Dom.write "<script> var data=[" & strText & "] </script>"
- For i = 0 To .eval("data.length") - 1
- Set cll = .eval("data[" & i & "]")
- k = k + 1
- For j = 0 To UBound(R)
- arr(k, j) = CallByName(cll, R(j), VbGet)
- Next
- arr(k, 9) = CallByName(cll, "LHMC_ID", VbGet)
- Next
- End With
- For i = 1 To k
- With Http
- .Open "POST", "http://bzflh.szjs.gov.cn/TylhW/lhmcAction.do?method=queryDetailLhc" _
- & "&lhmcId=" & arr(i, 9) _
- & "&waittype=2", False
- .send
- strText = .responseText
- Debug.Print strText
- arr(i, 9) = Split(Split(strText, "户籍所在区:</b>")(1), "<")(0)
- End With
- Next
- ActiveSheet.UsedRange.offset(1).ClearContents
- Range("a2").Resize(k, UBound(arr, 2)) = arr
- MsgBox "查询OK"
- Set Http = Nothing
- Set Dom = Nothing
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|