dimanche 21 avril 2019

Pass authorization via xmlhttp

I wish to send a login request using xmlhttp. However, the VBA code I put didn't work. Here is my code:

Public Sub xmlhttpRequest()

Dim xmlhttp As New MSXML2.xmlhttp, myurl As String, user As String, 
password As String

myurl = "https://eresearch.fidelity.com/eresearch/evaluate/fundamentals/earnings.jhtml?tab=details&symbols=GOOG"

xmlhttp.Open "POST", myurl, False
user = "myusername"
password = "mypassword"
xmlhttp.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)
xmlhttp.send

MsgBox (xmlhttp.responseText)

End Sub

The code "Base64Encode" I put seems to be a problem. Your advice would be much appreciated!




Aucun commentaire:

Enregistrer un commentaire