宏/ VBA从www.Eppraisal.com获取值 [英] Macro / VBA to fetch values from www.Eppraisal.com

查看:346
本文介绍了宏/ VBA从www.Eppraisal.com获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Excel宏从www.Eppraisa.com获取一些值。



但是我不知道PropID的价值是什么。这就是为什么宏适用于URL1但不适用于URL2,因为我认为URL2具有错误的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
设置xmlHttp = CreateObject(MSXML2.XMLHTTP)

 '这个工程
xmlHttp.OpenGET,URL1,False

'但不适用于b elow url :(
'xmlHttp.OpenGET,URL2,False

xmlHttp.setRequestHeaderContent-Type,text / xml


xmlHttp.send

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

对于每个ieInp在ieDom.getElementsByTagName(p)
如果ieInp.className =ColorAccent6 FontBold FontSizeM Margin0 Padding0然后
strEppraisalValue = ieInp.innerText
ElseIf ieInp.className =FontSizeA Margin0 DisplayNone HighLow然后
strEppraisalHighLow = ieInp.innerText
结束如果
下一个结束子


可以有人请帮忙吗这将是一个很好的帮助我



谢谢。

解决方案

使用Mozilla Firefox& Firebug您可以识别请求和响应。



下面的步骤适用于您进行的任何搜索。



1 将以下网址复制到Firefox浏览器。



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





2 打开FireBug并查找以下请求。 Goto Net Tab> XHR如下图所示。





3 展开节点并转到参数选项卡。它显示了GET请求需要执行的所有输入参数。





4 最后,我们可以在响应选项卡中看到服务器的响应。 >


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

Can anybody please help? It would be a great help for me

Thanks.

解决方案

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/

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

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

.

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

这篇关于宏/ VBA从www.Eppraisal.com获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆