XMLHTTP60 can get text but not XML

hilss

Active Member
Joined
May 22, 2007
Messages
379
Hello all,
I am trying to fetch XML data from a web site. I manage to access the data as text, and I wrote a function to parse it (very lengthy).
I found that you can getElementsByTagName but this is not working for me. Here is my code:

Rich (BB code):
Private Sub GetPredictItData()

    Dim Req As New XMLHTTP60
    Dim myurl As String
    Dim myUrlId As String
    
    myUrlId = 3633
    
    myurl = "https://www.predictit.org/api/marketdata/markets/" & myUrlId
    
    Req.Open "GET", myurl, False
    Req.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    Req.send
    
    Dim Resp As New MSXML2.DOMDocument60
    Resp.LoadXML Req.responseText   '  this is the part that is not working as expected 

End Sub

Req.responseText has content, but Resp has ZERO childNodes. I would like to get the elements by Tag Name... but since Resp has no content, I cannot do anything.
Thanks,
hilss
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top