|
楼主 |
发表于 2020-9-12 21:13
|
显示全部楼层
Public Sub 内蒙古查询()
'Cells(rowi, 1),Cells(rowi, 2)分别对应考生号,密码
Dim strURL As String
Dim strData As String
Dim XmlHttp As Object
Dim a() As Byte
'Set XmlHttp = CreateObject("MSXML2.XMLHTTP")
Set XmlHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
'strURL = "http://cx.ahzsks.cn/pugao/pgcj2018_in.php"
Set oDoc = CreateObject("htmlfile")
'With CreateObject("WinHttp.WinHttpRequest.5.1")
arr = Range("C2:J21")
'MsgBox arr(1, 2)
With XmlHttp
For rowi = 2 To 21
ksh = Cells(rowi, 1)
mm = Cells(rowi, 2)
'MsgBox ksh
'MsgBox mm
.Open "GET", "https://www.nm.zsks.cn/ptgxzs/xxcx/", False
.send
.Open "GET", "https://www1.nm.zsks.cn/xxcx/gkcx/gkcf20.jsp", False
.setRequestHeader "Host", "www1.nm.zsks.cn"""
.setRequestHeader "Connection", "keep-alive"
.setRequestHeader "Upgrade-Insecure-Requests", "1"
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 Edg/85.0.564.51"
.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
.setRequestHeader "Sec-Fetch-Site", "same-site"
.setRequestHeader "Sec-Fetch-Mode", "navigate"
.setRequestHeader "Sec-Fetch-User", "?1"
.setRequestHeader "Sec-Fetch-Dest", "document"
.setRequestHeader "Referer", "https://www.nm.zsks.cn/ptgxzs/xxcx/"
.setRequestHeader "Accept-Encoding", "gzip, deflate, br"
.setRequestHeader "Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
.setRequestHeader "Cookie", "JSESSIONID=3h4Xfc2GyThS29JN0BRJCQmqr1d1vnpfgJCQ1L2xN4NNhBJMpvVH!365274535; BIGipServerweb_pool=2818638090.36895.0000"
.send
.Open "POST", "https://www1.nm.zsks.cn/xxcx/gkcx/gkcf20.jsp", False
.setRequestHeader "Host", "www1.nm.zsks.cn"
.setRequestHeader "Connection", "keep-alive"
.setRequestHeader "Content-Length", "59"
.setRequestHeader "Cache-Control", "max-age=0"
.setRequestHeader "Upgrade-Insecure-Requests", "1"
.setRequestHeader "Origin", "https://www1.nm.zsks.cn"
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 Edg/85.0.564.51"
.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
.setRequestHeader "Sec-Fetch-Site", "same-origin"
.setRequestHeader "Sec-Fetch-Mode", "navigate"
.setRequestHeader "Sec-Fetch-User", "?1"
.setRequestHeader "Sec-Fetch-Dest", "document"
.setRequestHeader "Referer", "https://www1.nm.zsks.cn/xxcx/gkcx/gkcf20.jsp"
.setRequestHeader "Accept-Encoding", "gzip, deflate, br"
.setRequestHeader "Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
.setRequestHeader "Cookie", "JSESSIONID=3h4Xfc2GyThS29JN0BRJCQmqr1d1vnpfgJCQ1L2xN4NNhBJMpvVH!365274535; BIGipServerweb_pool=2818638090.36895.0000"
.send "v_ksh=" & ksh & "&v_mm=" & mm & "&query=%B2%E9++%D1%AF"
strText = .getAllResponseHeaders
strText = .responseText
Debug.Print strText
strText = .responseText
oDoc.body.innerHTML = Replace(StrConv(.responseBody, vbUnicode), " ", "")
Set tr = oDoc.all.tags("Table")(1).Rows
'MsgBox tr(1).Cells(1).innerText
arr(rowi - 1, 1) = tr(1).Cells(1).innerText
arr(rowi - 1, 2) = tr(1).Cells(2).innerText
arr(rowi - 1, 3) = tr(1).Cells(3).innerText
arr(rowi - 1, 4) = tr(1).Cells(4).innerText
arr(rowi - 1, 5) = tr(1).Cells(5).innerText
arr(rowi - 1, 6) = tr(1).Cells(6).innerText
arr(rowi - 1, 7) = tr(1).Cells(7).innerText
arr(rowi - 1, 8) = tr(1).Cells(8).innerText
Next
Range("C2:J21") = arr
End With
End Sub
|
评分
-
1
查看全部评分
-
|