HTTP GET Request Using VB or VBA

2019-08-19 01:05发布

I seen a post "Trying to integrate an HTTP GET request in MS-Access".

I used a very similar code, except I entered the authorization key code.

I am unable to determine if the program connected and fail or anything??? I get no responds.

This is my code below, but it doesn't seems to work and no error: Do you see any wrong with my code below??? I am also using it with VBA Access. Once I can get in, there is a "Response Body" box what has Json data and I want to put it into a temp file and copy it to an text file.

I was going to use what the other post used to capturing the data.

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

    sUrl = "https://api.ngs.nfl.com/tracking/game/play?gameKey=57444&playId=51"
    sAuth = "NGS AKIAIX2CQ7IEOKPOTKDQ:uNniaOp4jH8jcK9i/EtQhurlilc="

    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", sUrl, False
        .setRequestHeader "Authorization", "Basic " & sAuth
        .send
        Debug.Print .responseText
        Debug.Print .getAllResponseHeaders
    End With
End Sub

0条回答
登录 后发表回答