Solved

How to connect to RETS MLS Data with ColdFusion?

Posted on 2007-11-13
5
3,152 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
Comment Utility
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
Comment Utility
What version of RETS are you trying to access?
0
 

Author Comment

by:MichaelEvangelista
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Help on HTML 1 62
Use System DSN 6 70
Web Site Hosting 10 68
WCAG (Web Content Accessibility Guidelines) levels 3 40
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…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

762 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now