PHP
  Home arrow PHP arrow Page 2 - RETS: Small Name, Big Possibilities
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

RETS: Small Name, Big Possibilities
By: Ron Goff
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 15
    2004-10-25


    Table of Contents:
  • RETS: Small Name, Big Possibilities
  • How it Works
  • The Basic Login in Detail
  • The Login Script
  • Authentication
  • Benefits of RETS
  • Final Thoughts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    RETS: Small Name, Big Possibilities - How it Works
    ( Page 2 of 7 )

    You first have to develop a client. A client is a program that connects to the RETS server and extracts certain information and displays or places what it pulled into a database. There are many pre-made clients available, some even written in PHP, but I found that they do not work for every RETS server straight out of the box and require a bit of updating to work with a specific RETS server, which is not an easy task when the code does not have sufficient comments or documentation. That is why I suggest building your own; usually one of the best ways to learn anything is doing it on your own. The Wright Brothers would have never built their first plane if they were waiting to update someone else's plane. Let's look at what the client program will have to do.

    Most of the RETS servers implement Digest Authentication. This is much more secure than your usual Basic Authentication, which makes it a little more complicated to program. Digest uses MD5 to encrypt usernames and passwords and other variables so that information is not sent over the Internet. We will get into the login process a little bit later in this article.

    Once you log in, you will receive a session id which you will need to save so you can log back in to request information. RETS servers have many options to pull information out; you can search by price, amenities, location, school district, Realtor office and basically anything else that is a field in the RETS server.

    This is how a common session might look.

    The Common Session 

    Program Step 1
    Logs in and retrieves the session_id and then logs out

    Program Step 2
    Logs in using the session_id and requests a list of property id numbers and then logs out

    Program Step 3
    Logs in using the session_id and requests detailed information on specific id number and then logs out

    Program Step 4
    repeat step 3 for all property ids in the database

    Program Step 5
    session completed.

    Once you have a successful login and request information, the RETS server will send a page back with all the information you requested. The information will be in the same order that you sent the request, so if you asked for bedrooms, bathrooms and pool, it would come back in that same order. The content will be in a format that looks like the below sample.

    Sample Data 

    HTTP/1.1 200 OK (This lets us know everything was fine retrieving from this page)
    Server: Microsoft-IIS/5.0 (Type of server the RETS server is)
    Date: Thu, 08 Jul 2004 23:05:33 GMT (The date and time of the transaction)
    X-Powered-By: ASP.NET (What type of programming language is used on the RETS server)
    Cache-Control: private
    RETS-Version: RETS/1.0 (The standards version the RETS server complies with)
    Content-Type: text/plain (Format of the information below)
    Cache-control: private
     
    <RETS ReplyCode="0" ReplyText="Operation Successful." > (Everything is ok)
    <COUNT Records="4" /> (Number of records were found)
    <DELIMITER value="09" />
    <COLUMNS> ListingPrice MLNumber Status </COLUMNS> (How the data is formatted)
    <DATA> 198500 13603 A </DATA> (The data)
    <DATA> 93000 13880 A </DATA>
    <DATA> 318000 14029 P </DATA>
    <DATA> 275000 14056 P </DATA>
    </RETS>

    You can see from the above sample data that it is in an XML format which makes it really easy to parse through and place into a database.  This is similar to RSS news feeds, which makes it very easy to place news into a database.  You may have tried to parse MLS data off of a website before  - it is nearly impossible, this is why this is so great; you get the data in a very easy to parse format and can worry about bigger things like how to tell your co-worker that a water cooled computer does not mean pouring water on the processor every few hours.

    The system we built in our office checks the RETS server every hour for any updates and adds and removes properties based on the information that the server spits back. We have automated it through a cron job and we can just sit back and let the computer do all the work, day and night.



     
     
    >>> More PHP Articles          >>> More By Ron Goff
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT