|
Public Sub 承德2018中考成绩查询()
Dim strURL As String
Dim strData As String
Dim xmlHttp As Object
Set xmlHttp = CreateObject("MSXML2.XMLHTTP")
strURL = "http://zsks.cdcedu.cn/InfoCx_Result.aspx"
Set oDoc = CreateObject("htmlfile")
'--------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------
With xmlHttp
For rowi = 2 To 10
.Open "POST", strURL, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" '一般可以不用修改
.setRequestHeader "Referer", "http://zsks.cdcedu.cn/" '进行防盗链处理
.setRequestHeader "Cookie", "Hm_lvt_a1a2049db19308d35c239268febaca2d=1530603953,1531062375,1531097425; Hm_lpvt_a1a2049db19308d35c239268febaca2d=1531231804"
.setRequestHeader "If-Modified-Since", "0" '不读缓存
.send "id=159&number=" & Cells(rowi, 1) & "&xm=" & Cells(rowi, 2) ' 在使用 POST 方式时要才使用.send strData
Do While .readystate <> 4
DoEvents
Loop
oDoc.body.innerHTML = .responseText
Set tr = oDoc.all.tags("Table")(1).Rows
For ci = 0 To 13
Cells(rowi, ci + 4) = tr(1).Cells(ci).innerText
Next
Next
End With
End Sub
|
|