Through the previous 4 parts of this tutorial we’ve created everything we need to download our MLS feed with RETS. Now we need to make one small change to our batch file, and execute it. We need to use an Advanced Query to retrieve only Active listings from our RETS provider. You may want to first read over the Batch File documentation. Remember in creating the Source I mentioned choosing Status as a searchable field?

Creating an Advanced Query For Active Listings

First we need to go into our /vieleRETS/batch_control_files directory with a file browser or ftp manager. Open to edit the file with the name of your Extract. According to this forum post we need to query L_Status=1_0,1_1 so the final product should resemble this:

RETS Batch Setting

Save this file back to your server where it belongs. Now we’re ready to download our listings!(I know I know, its been long enough already…)

Executing the Batch File

If you’re on a remote server you will need to ssh into your server and into the vieleRETS directory. If you’re on a local machine just navigate via command prompt to that directory. If you read the documentation linked to above you know there are a few options while executing. But here goes nothing. I’ll use “My_Extract” as the name of your Extract, you should replace this with whatever you called yours. From the command line enter the command :

php -f ./run_interactive_job.php batch_control_files/My_Extract

With a little luck and a lot of time you are now downloading your listings. The only thing left is to schedule your download. I’ll leave this up to you as every hosting environment is different. Remember however when you set up your scheduled executer you will need to state the full directory path instead…

php -f /somedir/vieleRETS/run_interactive_job.php batch_control_files/My_Extract

Now go get a cup of coffee and relax after this stressful ordeal! You deserve it!