PHRETS icon indicating copy to clipboard operation
PHRETS copied to clipboard

Default code example provided is not Working, Needs Help.

Open pareshsojitra opened this issue 4 years ago • 1 comments

Hi,

I'm getting an error : ( ! ) Fatal error: Uncaught PHRETS\Exceptions\RETSException: Invalid Query Syntax in D:\wamp64\www\php\phretsn\vendor\troydavisson\phrets\src\Session.php on line 427

1 | 0.0007 | 371784 | {main}( ) | ...\index.php:0 2 | 1.2339 | 2424280 | PHRETS\Session->Search( ) | ...\index.php:35 3 | 1.2343 | 2427792 | PHRETS\Session->request( ) | ...\Session.php:280

Here is my Code : /* Configuration */ $config = new \PHRETS\Configuration; $config->setLoginUrl( $rets_login_url ); $config->setUsername( $rets_username ); $config->setPassword( $rets_password );

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

/* Login */ $connect = $rets->Login();

/* Get Feeds / $results = $rets->Search('Property', 'RE_1', '', ['Limit' => 3, 'Select' => 'LIST_1,LIST_105,LIST_15,LIST_22,LIST_87,LIST_133,LIST_134']); foreach ($results as $r) { var_dump($r); }

Thank you.

pareshsojitra avatar May 25 '20 20:05 pareshsojitra

It looks like you may be providing an empty string for the third argument to $rets->Search. This argument needs to be a valid DMQL query. The example code uses an asterisk to retrieve all resources, which you'll rarely want to do. You might want to provide something like (ACTIVE=1) or (TIMESTAMP=2020-08-17T00:00:00+) to retrieve all resources modified after a specific date. Of course "ACTIVE" and "TIMESTAMP" are just example field names, you'll want to use the actual field names for the specific IDX server you're working with.

bradroberts avatar Aug 17 '20 13:08 bradroberts