I need to login a https website via httprequest.
I am trying to use the code from this post VBA WinHTTP to download file from password proteced https website
but i only get that answer: "User not found" - but I know the user and password works fine when I login manually.
My main doubt is where the parameters in the string strAuthenticate came from?
And also why I can not see any http header with the "authorization" word in it or with my username/password in it when i use a http sniffer program.
The website is a form-base authentication type. Is there a way (or should I) inform in my code any reference to the HTML textboxes objects for username and password?(And in this case how could I do it?)
Sub SaveFileFromURL()
Dim WHTTP As WinHttp.WinHttpRequest
Set WHTTP = New WinHttpRequest
mainUrl = "https://www.somesite.com.br/Login.php"
myuser = "userA"
mypass = "passuserA"
strAuthenticate = "start-url=%2F&user=" & myuser & "&password=" & mypass & "&switch=Log+In"
WHTTP.Open "POST", mainUrl, False
WHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
WHTTP.SetRequestHeader "Authorization", "Basic " & EncodeBase64(StrConv( myuser & ":" & mypass, vbFromUnicode))
WHTTP.Send
End Sub