Public Function xml_httpSend(modth As String, postUrl As String, SynModth As Boolean, sendData As String)' Set xml_http = New MSXML2.XMLHTTP If SynModth Then '异步过程 Timer1.Interval = 1 '定时器实现onreadystatechange事件句丙 End If xml_http.open modth, postUrl, SynModth If modth = "post" Then ' post修改MIME类 xml_http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xml_http.setRequestHeader "Content-Length ", Len(sendData) End If xml_http.send (sendData) end functionPrivate Sub Timer1_Timer()'定时器操作 If xml_http.ReadyState = 4 Then Timer1.Interval = 0 If xml_http.Status = 200 Then msgbox xml_http.responseText'第一次返回登陆页面代码,第2次返回登陆成功 End If End IfEnd Sub
Set xml_http = New MSXML2.XMLHTTP
If SynModth Then '异步过程
Timer1.Interval = 1 '定时器实现onreadystatechange事件句丙
End If
xml_http.open modth, postUrl, SynModth
If modth = "post" Then ' post修改MIME类
xml_http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xml_http.setRequestHeader "Content-Length ", Len(sendData)
End If
xml_http.send (sendData)
end functionPrivate Sub Timer1_Timer()'定时器操作
If xml_http.ReadyState = 4 Then
Timer1.Interval = 0
If xml_http.Status = 200 Then
msgbox xml_http.responseText'第一次返回登陆页面代码,第2次返回登陆成功
End If
End IfEnd Sub