Search code examples
phpretsphrets

SearchQuery() doesn't run (undefined method PHRETS\Session::SearchQuery())


I am trying to extract some basic details from the RETS server using PHRETS but been getting this error

[*Uncaught Error: Call to undefined method PHRETS\Session::SearchQuery() in D:\Software\XAMPP\htdocs\PHRETS-master\RetsExtract.php:21 Stack trace: #0 {main} thrown in D:\Software\XAMPP\htdocs\PHRETS-master\RetsExtract.php on line 21*]

and can't seem to understand what is causing this.

So based on retsmd.com, I have Property as the resource, Listing as the class and based on these two I think I can extract the data using the SearchQuery() method.

I am relatively new to PHP and the RETS environment but here is the part of the code:

<?php

require_once("vendor/autoload.php");

$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://matrixrets.crebtools.com/rets/Login.ashx');
$config->setUsername('userName');
$config->setPassword('pwdHere');

// optional.  value shown below are the defaults used when not overridden
$config->setRetsVersion('1.8'); // see constants from \PHRETS\Versions\RETSVersion
$config->setUserAgent('agenUsr/1.0');
$config->setUserAgentPassword('pwdHere'); // string password, if given
$config->setHttpAuthenticationMethod('digest'); // or 'basic' if required 
$config->setOption('use_post_method', false); // boolean
$config->setOption('disable_follow_location', false); // boolean

$rets     = new \PHRETS\Session($config);
$bulletin = $rets->Login();

$search = $rets->SearchQuery("Property", "Listing", "(ListDate=1990-01-01+)");
?>

I am using this part of the from the GitHub repo of the PHRETS. Any idea what could be the issue here?

Thanks


Solution

  • This depends on the PHRETS version you are using.

    Seems like you are using PHRETS library version 2.* and you referred the documentation of version 1.*

    Both will work fine.