Search code examples
phpretsphrets

RETS IDX with PHRETS Setup Returning No Results


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);

Solution

  • 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.