winhttp打开需要用户名密码验证的网页
Dim WinHttpReq As WinHttp.WinHttpRequest Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0 Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1 Private Sub Form_Load() Set WinHttpReq = New WinHttpRequest End Sub Private Sub Command1_Click() WinHttpReq.Open "GET", _ "http://msdn.microsoft.com/downloads/samples/internet" & _ "/winhttp/auth/authenticate.asp", False ' Set the user name and password. WinHttpReq.SetCredentials "UserName", "Password", _ HTTPREQUEST_SETCREDENTIALS_FOR_SERVER WinHttpReq.Send ' Display the status code and response headers. Text2.Text = WinHttpReq.Status & " " & WinHttpReq.StatusText Text1.Text = WinHttpReq.GetAllResponseHeaders & " " & WinHttpReq.ResponseText End Sub