源码来自于https://download.csdn.net/download/zjbdlh/11148367
Private Function XMLHttpRequest(ByVal XmlHttpMode$, ByVal XmlHttpURL$, ByVal XmlHttpData$)
Dim MyXmlhttp
On Error GoTo wrong
Set MyXmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1") '创建WinHttpRequest对象
With MyXmlhttp
.SetTimeouts 50000, 50000, 50000, 50000 '设置超时时间
If XmlHttpMode = "GET" Then '异步GET请求
.Open "GET", XmlHttpURL, True, "myuserid", "mypassword"
Else
.Open "POST", XmlHttpURL, True, "myuserid", "mypassword" '异步POST请求
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
End If
'无Http头信息
.Send (XmlHttpData)
.WaitForResponse '异步等待
If MyXmlhttp.Status = 200 Then '成功获取页面
XMLHttpRequest = StrConv(.ResponseBody, vbUnicode)
Else
MsgBox "Http错误代码:" & .Status, vbInformation, "提示"
End If
End With
Set MyXmlhttp = Nothing
Exit Function
wrong:
MsgBox "错误原因:" & Err.Description & "", vbInformation, "提示"
Set MyXmlhttp = Nothing
End Function
你是不是没有输入验证码
具体是报什么错误信息呢?
顶一下
要登录检验吧
可能是反爬机制吧
用selenium试一下?