troydavisson / PHRETS

PHP client library for interacting with a RETS server to pull real estate listings, photos and other data made available from an MLS system
http://troda.com
MIT License
451 stars 236 forks source link

Version 2.0 returns zero results #174

Open Jujunol opened 7 years ago

Jujunol commented 7 years ago

Brief

I have a previous version of phRETS and doing a little updating. Tried updating this dependency but it seems using version 2.0 always returns zero results

Code 1.x

$rets = new phRETS();

$rets->Connect(env('crea_host'), env('crea_username'), env('crea_password'));
$results = $rets->SearchQuery("Property", "Property", "LastUpdated=2015-01-01", [
    'Format' => "STANDARD-XML",
    'Count' => 1,
    'Limit' => 100,
]);

dd($results)

Code 2.0 attempt

$config = new Configuration();
$config->setLoginUrl(env('CREA_URL'))
    ->setUsername(env('CREA_USERNAME'))
    ->setPassword(env('CREA_PASSWORD'))
    ->setRetsVersion('1.7.2');

$client = new Session($config);
$connection = $client->login();

$results = $client->Search('Property', 'Property', 'LastUpdated=2015-01-01', [
    'Format' => "STANDARD-XML",
    'Count' => 1,
    'Limit' => 3,
]);

dd($results);
alwintom commented 5 years ago

Looks like the parser is unable to parse when the format is STANDARD-XML. Changing it to COMPACT-DECODED worked for me. When the format is STANDARD-XML the parser complains about 'No delimiter found' and fails to parse any of the records.

jeffkee commented 1 year ago

Is there a resolution to this Troy? I'd pay for this to be resolved.

troydavisson commented 1 year ago

Last I knew (and still seems to be true), CREA's RETS server wasn't actually compliant with the RETS standard. When you request STANDARD-XML, servers respond in a completely different format which is much more verbose compared to COMPACT or COMPACT-DECODED. I also thought that I'd seen CREA distributing a modified version of PHRETS 1.x which worked around the differences.

I don't personally have active credentials for a feed from that server so I can't confirm what's happening, but that's what it sounds like.

jeffkee commented 1 year ago

Troy - yes you are correct. They had a butchered version of it, 1.02rc that was modified to work with the XML.

The solution that Paul-DS suggested on this thread worked for me: https://github.com/troydavisson/PHRETS/issues/99