1

I have been accessing a website and entering 3 parameters and an Authorization to get access to data. When processed, the data appears in a Responds Window on the website, and I manually select all and copy it to a text file. The Authorization Key is good for a day, and I just need to update the 3 parameters each time when I make a request.

I have to repeat this process for about 50+ times.

I have tried using this sample code from someone on this website over 1 year ago, and I have no errors, and it doesn't seems to connect.

I am perfectly happy trying to get it working by manually entering the authorization key code for now. This takes most of the coding out.

Sub Test()
    Dim sUrl As String, sAuth As String

    sUrl = "https://cl.nnn.nnnn.com/api/tracking/game/play?gameId=2017121601&gamekey=57444&playId=51"
    sAuth = "NGS AKIAIX2XXXXXXXXXPOTKDQ:XXXXXXXXXXXkfmT7enl6I="

    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", sUrl, False
        .SetRequestHeader "Authorization", "Basic " & sAuth
        .Send
        Debug.Print .ResponseText
        Debug.Print .GetAllResponseHeaders
    End With
End Sub
Erik A
  • 31,639
  • 12
  • 42
  • 67
U70115
  • 25
  • 1
  • 6
  • 1
    Duplicate? https://stackoverflow.com/questions/1358550/xmlhttp-request-basic-authentication-issue – dbmitch Jun 05 '18 at 17:20
  • I would suggest you to try https://github.com/VBA-tools/VBA-Web . It will save you many headaches ... – px1mp Jul 13 '20 at 10:02

0 Answers0