4

I'm in the middle of trying to learn how to setup a connection to a MIBOR IDX server using PHRETS and I've hit a wall. I have this very basic search query, just trying to get all results before I start trying to filter them, but my search is returning 0 results! I thought it might be that MIBOR requires a few fields to be passed in the search, but I don't know how to find out which fields those might be... Any help is greatly appreciated!

You can download my metadata here

Here is my code:

<?php
date_default_timezone_set('America/New_York');

require_once("vendor/autoload.php");

$rets_login_url = 'http://matrixrets.miborblc.com/rets/Login.ashx';
$rets_username = 'xxxxxxx';
$rets_password = 'xxxxxxx';

// CONNECT TO IDX
$config = new \PHRETS\Configuration;
$config->setLoginUrl($rets_login_url)
        ->setUsername($rets_username)
        ->setPassword($rets_password)
        ->setRetsVersion('1.7.2');

$rets = new \PHRETS\Session($config);

$connect = $rets->Login();

$system = $rets->GetSystemMetadata();

// SEARCH RECORDS
$results = $rets->Search('Property', 'Listing');
var_dump($results);
Colin
  • 2,428
  • 3
  • 33
  • 48

2 Answers2

3

Take a look at the open source http://retsmd.com.

After logging in you can select a Resource Type, and view all of the keys available along with examples for what their system metadata looks like. The application uses the PHRETS library itself too so if you need to look at example code on how they get their data you can view their repository.

It's a bit difficult to tell you what is wrong with your resultset because there is not a naming convention or field requirement that every feed has to adhere to (as stupid as that is). And you definitely shouldn't be passing those login records around. So you may end up having to use a combination of RETSmd and contacting your respective feed managers.

Repo: https://github.com/troydavisson/RETS-MD

acupofjose
  • 2,159
  • 1
  • 22
  • 40
  • Thanks for the quick response, Schultzie! Is there a way to pull actual real estate search results from RETS MD? Or is it only for getting metadata? – Colin Nov 17 '15 at 15:19
  • @Colin RETSMD does support previewing data on some feeds. That would be after you've selected a resource type, in the box that appears before metadata table rows, there should be a button that says `Preview Live Data (new)` that you can use – acupofjose Nov 17 '15 at 15:35
  • If I don't see Preview Live Data anywhere on RETSMD, do you think that means that my feed does not support previewing data? – Colin Nov 18 '15 at 23:40
2

I just wanted to let everyone know that I have solved the issue and share my solution in case anyone is having a similar issue. As Shultzie explained, the main issue is that RETS does not have a naming convention. It turned out I needed to include a query with the date variable or the IDX would return 0 results (I guess some sort of error handling convention would also be a nice addition to RETS IDX's). Anyway, I updated my Search to the following and everything started working:

$results = $rets->Search(
    'Property', 
    'Listing', 
    "(MatrixModifiedDT=1980-01-01T00:00:00+)", 
    ["Limit"=>1]
);

Adding the modified date was mainly just a guess on my part, but I would recommend locating the system name of and adding a modified date to your query if you're having a similar issue and haven't tried that already.

Colin
  • 2,428
  • 3
  • 33
  • 48