سؤال

I need to fetch some values from www.Eppraisa.com using Excel Macro.

But I don't know what should be the value of PropID. That's why the macro works for URL1 but not for URL2 because I think URL2 has a wrong propID

Const URL1 As String = "http://www.eppraisal.com/home-values/property_lookup_eppraisal?a=1122%20E%20Loyola%20Dr&z=85282&propid=42382460"

Const URL2 As String = "http://www.eppraisal.com/home-values/property_lookup_eppraisal?a=19732%20E%20Reins%20Rd&z=85142&propid=31402642"

Sub xmlHttp()
    Dim xmlHttp As Object
    Set xmlHttp = CreateObject("MSXML2.XMLHTTP")

    ' This works
    xmlHttp.Open "GET", URL1, False

    ' But doesn't work for below url :(
    'xmlHttp.Open "GET", URL2, False

    xmlHttp.setRequestHeader "Content-Type", "text/xml"


    xmlHttp.send

    Dim ieDom As New HTMLDocument
    Dim html As Object
    Set html = CreateObject("htmlfile")
    html.body.innerHTML = xmlHttp.responseText
    Debug.Print html.body.innerHTML
    ieDom.body.innerHTML = xmlHttp.responseText

    For Each ieInp In ieDom.getElementsByTagName("p")
        If ieInp.className = "ColorAccent6 FontBold FontSizeM Margin0 Padding0" Then
            strEppraisalValue = ieInp.innerText
        ElseIf ieInp.className = "FontSizeA Margin0 DisplayNone HighLow" Then
            strEppraisalHighLow = ieInp.innerText
        End If
    Next End Sub
هل كانت مفيدة؟

المحلول

With Mozilla Firefox & Firebug you can identify the request and response.

Below step applies to any search you make.

1 Copy the below URL to Firefox Browser.

http://www.eppraisal.com/home-values/property/1122-e-loyola-dr-tempe-az-85282-42382460/

enter image description here

2 Open Up FireBug and look for below request. Goto Net Tab > XHR as in below image.

enter image description here

3 Expand the node and goto Params tab. It shows all the input parameters which needs to go with the GET request.

enter image description here .

4 Finally we can see the response from server in the Response Tab.

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top