1

I am using the PHRETS PHP library to fetch the RETS data from the rets API. I have and issue with getting the Data. It's giving me the Requested Class not found Error. Please help to solve this Error. My Code is:

date_default_timezone_set('America/New_York');

require_once("vendor/autoload.php");

$log = new \Monolog\Logger('PHRETS');
$log->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG));



$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://rets.navicamls.net/login.aspx')
        ->setUsername('xxx')
        ->setPassword('xxx')
        ->setRetsVersion('1.7.2');

$rets = new \PHRETS\Session($config);
$rets->setLogger($log);

$connect = $rets->Login();


if ($connect) {
 echo "Connected!<br>";
}
else {
 echo "Not Connected!<br>";
 print_r($rets->Error());
 exit;
}


//results consists of Property, class, and query
$results = $rets->Search(
    "Property",
    "A",
    "*",
    [
        'QueryType' => 'DMQL2',
        'Count' => 1, // count and records
        'Format' => 'COMPACT-DECODED',
        'Limit' => 10,
        'StandardNames' => 0, // give system names
    ]
);

print_r($results); exit;
ferdynator
  • 6,245
  • 3
  • 27
  • 56
junkk rr
  • 55
  • 15
  • I don't know this library but I guess class A does not exists in this API :) – Robert Jul 18 '16 at 14:48
  • I am also newbie bro to use this API. Its real estate trasformation system API. from where the real estate listing we can show with Cronjob. I am nearby to my target, just stuck over it. :-( – junkk rr Jul 18 '16 at 14:50

1 Answers1

2

You need to first verify the name of the class in your search query is correct by looking up the metadata.

  1. Use RETSMD.com and enter the RETS Server login url, username, and password.
  2. Use the metadata functions in the PHRETS documentation on the main page

    a. $system = $rets->GetSystemMetadata();

    b. $classes = $rets->GetClassesMetadata('Property');

Andrew Briggs
  • 1,329
  • 12
  • 26
  • I have verified the first two perameters of search function from the "RetsMD.com" as according to the metadata they are providing. But it's giving now `Fatal error: Uncaught exception 'PHRETS\Exceptions\RETSException' with message 'Missing open parenthesis in subquery.` Fatal Error. – junkk rr Jul 19 '16 at 12:45
  • If you updated your code, please post it and also post the line that the error is on. – Andrew Briggs Jul 19 '16 at 13:46
  • i have just changed this search function `$results = $rets->Search( 'Agent', 'Agent', '*', [ 'QueryType' => 'DMQL2', 'Count' => 1, // count and records 'Format' => 'COMPACT-DECODED', 'Limit' => 99999999, 'StandardNames' => 0, // give system names ] );` – junkk rr Jul 19 '16 at 13:52
  • Error is `in C:\wamp\www\rets\PHRETS-master\src\Session.php on line 379` – junkk rr Jul 19 '16 at 14:01
  • Your code is hard to read in the comments. Please post the code in your question. You need to remove the comments "//" in your code because it may be commenting out the last right bracket and last right parenthesis. – Andrew Briggs Jul 19 '16 at 15:23
  • Andrew i have solved my problem. now i have better understanding over PHRETS and DMQL. :) – junkk rr Jul 20 '16 at 07:36
  • @junkkrr If my answers/comments provided useful information, please vote up my answer or mark answered. – Andrew Briggs Jul 20 '16 at 15:21
  • i have added useful tag to your question. but i had already tried your provided answer my own. Anyways, thanx for your time to comment it on my question. :) – junkk rr Jul 22 '16 at 09:14