How to connect to RETS MLS Data with ColdFusion?

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.
MichaelEvangelistaAsked:
Who is Participating?
 
splendorxConnect With a Mentor Commented:
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
 
digicidalCommented:
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
 
splendorxCommented:
What version of RETS are you trying to access?
0
 
MichaelEvangelistaAuthor Commented:
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
 
MichaelEvangelistaAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.