Zillow API





0
Date Submitted Wed. Jan. 30th, 2008 9:27 PM
Revision 1 of 1
Helper wallie
Tags ASP | xmlhttp | Zillow
Comments 0 comments
how to integrate with Zillow using classic ASP


<%

' Start out declaring our variables.

' You are using Option Explicit aren't you?

Dim objXmlHttp, objXmlDom

Dim strHTML



' This is the server safe version from MSXML3.

Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")





objXmlHttp.open "GET", "http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=(Zillow Id here)&address=7816+E+Gunning+Lane&citystatezip=99212", False



' Send it on it's merry way.

objXmlHttp.send



' Get the text of the response.

' This object is designed to deal with XML so it also has the

' following properties: responseBody, responseStream, and

' responseXML.  We just want the text so I use:

Set objXmlDom = objXmlHttp.responseXML



' Trash our object now that I'm finished with it.

Set objXmlHttp = Nothing



' All that's left to do is display the HTML we just retreived.

' I do it first as plain HTML (which gets interpretted by the

' browser like any other HTML) and then as source (by HTML

' encoding it so the tags display instead of rendering)

' The <h1>s and <table>s are just for appearence.





Dim Address, Latitude, Longitude

Dim oNode, oNodes

Dim sXPathQuery



sXPathQuery = "//SearchResults:searchresults/request/citystatezip"



Set oNode = objXmlDom.documentElement.selectSingleNode(sXPathQuery)

'Address = oNode.Text

sXPathQuery = "//SearchResults:searchresults/response/results/result"

Set oNodes = objXmlDom.documentElement.selectNodes(sXPathQuery)



For Each oNode in oNodes

     Street = oNode.selectSingleNode("address/street").Text

     City = oNode.selectSingleNode("address/city").Text

     state = oNode.selectSingleNode("address/state").Text

     ZipCode = oNode.selectSingleNode("address/zipcode").Text

     EstimateValue = oNode.selectSingleNode("zestimate/amount").Text

     OneweekChange = oNode.selectSingleNode("zestimate/oneWeekChange").Text

     LastUpdate = oNode.selectSingleNode("zestimate/last-updated").Text

     LowValue = oNode.selectSingleNode("zestimate/valuationRange/low").Text

     highValue = oNode.selectSingleNode("zestimate/valuationRange/high").Text

     PropertyChart = "<image src=http://www.zillow.com/app?chartDuration=1year&chartType=partner&height=150&page=webservice%2FGetChart&service=chart&showPercent=true&width=300&zpid=" & oNode.selectSingleNode("zpid").Text & ">"

     longitude = oNode.selectSingleNode("address/longitude").Text

     Latitude = oNode.selectSingleNode("address/latitude").Text

Next



%>

<html>

<head>

<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>

      <script>

         var map = null;

                 

         function GetMap()

         {

            var map = new VEMap('myMap');

            map.LoadMap(new VELatLong(<%=Latitude%>, <%=Longitude%>), 14 ,'r' , false);

            var pin = new VEPushpin(1, map.GetCenter(), null

            'Center of the Map', 'The Home You Requested');           

            map.AddPushpin(pin);

         }   



         </script>

</head>

<body onload="GetMap();">

        <table border="2" cellspacing="1" width="570" id="table3">

                <tr>

                        <td colspan="2">

                        <h2><font color="#59A3C1">Beta Estimate<br>

                        <span style="font-weight: 400"><font size="2">For <%=Street %>&nbsp;<%=city %>,&nbsp;<%=state %>&nbsp;<%=Zipcode%></font></span></font></h2>

                        </td>

                </tr>

                <tr>

                        <td height="31" width="257">&nbsp;<b><font size="2">Zestimate: <%=FormatCurrency(EstimateValue,0)%><br>

&nbsp;Last Updated: <%=LastUpdate %><br>

&nbsp;One week Change: <%=OneweekChange%><br>

&nbsp;Low Valuation: <%=FormatCurrency(LowValue,0)%><br>

&nbsp;High Valuation: <%=FormatCurrency(highvalue,0)%></font></b>

                        <p><font size="1" color="#59A3C1">Data provided by Zillow</font></td>

                        <td height="31" width="306"><%=PropertyChart%></td>

                </tr>

        </table>

<br>

<div id='myMap' style="position:relative; width:570px; height:400px;"></div>

View This Page Script Call: <a href="test.txt">test.txt</a>

</body>

</html>

 

walter chao

Comments

There are currently no comments for this snippet.

Voting

Votes Up


Votes Down