Get Information From XML From A URL

后端 未结 1 1807
日久生厌
日久生厌 2021-01-25 23:47

I\'m trying to extract information from this URL https://www.zillow.com/webservice/GetSearchResults.htm?zws-id=X1-ZWz18hxnbvw0ej_40oka&address=2912%20WEST%201ST%20STREET%20U

相关标签:
1条回答
  • 2021-01-26 00:37

    Try this, it worked for me. You'll just need to modify it slightly to work for you ...

    Sub GetInfo2()
        Dim objHttp As XMLHTTP60, objXml As DOMDocument60, strUrl As String
    
        Set objHttp = New XMLHTTP60
        Set objXml = New DOMDocument60
    
        strUrl = "https://www.zillow.com/webservice/GetSearchResults.htm?zws-id=X1-ZWz18hxnbvw0ej_40oka&address=2912%20WEST%201ST%20STREET%20UNIT%201&citystatezip=Jacksonville%20FL%2032254"
    
        With objHttp
            .Open "GET", strUrl, False
            .send
        End With
    
        If objXml.LoadXML(objHttp.responseText) Then
            Debug.Print objXml.DocumentElement.SelectSingleNode("response/results/result/zestimate/amount").Text
        End If
    End Sub
    

    ... obviously I stripped it back to the raw call so I could target the specifics.

    This also works ...

    objXml.DocumentElement.SelectSingleNode("//amount").Text
    

    ... just be careful with that one though.

    0 讨论(0)
提交回复
热议问题