Solved

How to connect to RETS MLS Data with ColdFusion?

Posted on 2007-11-13
5
3,216 Views
Last Modified: 2013-12-24
A client's MLS company offers realty listing information in the form of RETS xml data.

I've done several xml-based sites, usually reading the xml data into a mySQL database, but from what I am seeing, RETS is a bit different than a usual RSS feed, or visible XML file.

I am looking for sample code, or a UDF / CFC... or a decent tutorial... on connecting to RETS with ColdFusion.

Ideally I could read the data into a mySQL database once per day, and run my own searches and display templates against my familiar cf/db format.

So.. what I'd *really* like, is the code - or an explanation of building same - to read from the RETS server into a SQL insert query. From there I'd be home free.
0
Comment
Question by:MichaelEvangelista
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:digicidal
ID: 20277911
Well, I've never done anything with RETS, however I would definitely start with going over the documentation and definitions for the protocol revision your client is going to be using.

http://www.rets.org/documentation

After that, there are some other sites that have some articles that might provide a good documentation path for your research:

http://coldfusion.sys-con.com/read/40704.htm

http://www.realestatewebmasters.com/thread5795.html <-- PHP Version here... could be tweaked perhaps.

http://www.realestatewebmasters.com/showthread.php?t=14661&page=2

^^ Read post #17 and #21 on page 3 of the forum... - sadly the PHP Nazi's on this site banned him for calling the guy that said CF was dead and worthless an 'idiot'... which I certainly agree he was... however, he was also a moderator... :D
0
 
LVL 1

Expert Comment

by:splendorx
ID: 20408641
What version of RETS are you trying to access?
0
 

Author Comment

by:MichaelEvangelista
ID: 20408770
They told me it was 1.5, but the 'metadata version' is 2.01 (see below)

I have a url and a username/pw - if I go to the url and log in, I see a short XML file like this:

<RETS ReplyCode="0" ReplyText="Success">

      <RETS-RESPONSE>

MemberName=xxxxxxxxxxx
User=xxxxxxxxxxxx
Broker=xxxxxxxxxx
MetadataVersion=02.01.44653
MinMetadataVersion=02.01.44653
Login=/xxxxxxxxxxxxxxxxx
Search=/xxxxxxxxxxxxxxxxxxx
GetMetadata=/prod_150r10/GetMetadata
GetObject=/prod_150r10/GetObject
Logout=/prod_150r10/Logout
</RETS-RESPONSE>
</RETS>

Beyond that, I am not sure what to do!

I found a free RETS client called VieleRETS (php)
It is easy to set up, and everything seems to be functioning as expected ...
except I am not pulling any listings!
Using the Viele interface, I can see the available columns for the data, and if I choose "Office" as
the resource, I can see that there are a few hundred entries,
but if I choose "Property", and then "Residential" or "Commercial" as the
listing 'class', I get no listings found.

I am obviously well-connected because I am seeing the available fields and
getting success messages for the general connection.
However, both the auto-detect and the debug show some of the responses as
"unauthorized".

I have a feeling I am so close to success, yet something must be wrong
Any help you can give at this point is greatly appreciated!
0
 
LVL 1

Accepted Solution

by:
splendorx earned 500 total points
ID: 20416679
I have just recently started using RETS 1.5 with CF 8 and it was a little confusing initially.  You have to really read into the RETS documentation because it is not clear.  Here is a function I built to login:

      <cffunction name="getAuthenticated" access="public" returntype="any">
            
            <cfargument name="userName" type="string" required="yes">
            <cfargument name="password" type="string" required="yes">
      
            <!--- First request to get Authenticate Information --->
            <cfhttp url="http://retswebsiteiuse.com/CRMLS/login?rets-version=rets/1.5" method="get" username="#ARGUMENTS.userName#" password="#ARGUMENTS.password#">
                  <cfhttpparam name="Accept" type="header" value="text/xml,text/plain;q=0.5">
                  <cfhttpparam name="User-Agent" type="header" value="#userAgent#">
                  <cfhttpparam name="RETS-Version" type="header" value="#retsVersion#">
            </cfhttp>
            
            <!---
            <cfdump var="#cfhttp#" /><br>
            <cfdump var="#GetHTTPRequestData().headers#">
            --->
            <!--- IMPORTANT--->
            <cfset tempCookie = cfhttp.Responseheader["Set-Cookie"]>
            
            <cfreturn tempCookie>
            
      </cffunction>

The key is to obtain the set-cookie value from the return header response.  You must maintain a session with that value.  Then, pass that value with your next request transaction.  This has successfully worked for me  and not sure what the differences are between the other version of RETS.

Also, I noticed from your initial response that it appears that you do not have access to the search method.  I have not played with the GetObject method yet; perhaps, that will return what you are seeking.

Hope that helps!

Terry
0
 

Author Closing Comment

by:MichaelEvangelista
ID: 31409125
Thanks for the info - I may have more questions to get this working but will assign points now, best answer I got - thanks again
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question