PHP致命错误:未捕获的异常' PHRETS \ Exceptions \ RETSException' with message'在子查询中缺少左括号

时间:2017-03-11 12:15:02

标签: rets phrets

我正在使用PHRETS PHP库从rets API获取RETS数据。我有获取数据的问题。它给出了#34; PHP致命错误:未捕获的异常' PHRETS \ Exceptions \ RETSException' with message'在子查询中缺少左括号。参考编号:fc63ca3e-c8a8-44cf-a0ce-4c729ce91fcc'在/XXXX/vendor/troydavisson/phrets/src/Session.php:379"。请帮忙解决这个错误。我的代码是:

<pre><code>
date_default_timezone_set('America/New_York');
require_once("vendor/autoload.php");
$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://sef.rets.interealty.com/Login.asmx/Login');
$config->setUsername('XXXX');
$config->setPassword('XXXX');
// optional.  value shown below are the defaults used when not overridden
$config->setRetsVersion('1.7.2'); // see constants from \PHRETS\Versions\RETSVersion
$config->setUserAgent('RETS-Connector/1.2');
$config->setUserAgentPassword('123456'); // string password, if given
$config->setOption('use_post_method', false); // boolean
$config->setOption('disable_follow_location', false); // boolean

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

$connect = $session->Login();

$system = $session->GetSystemMetadata();
//var_dump($system);

$resources = $system->getResources();
$classes = $resources->first()->getClasses();
//var_dump($classes);

$classes = $session->GetClassesMetadata('Property');
//var_dump($classes->first());

$results = $session->Search("Property", "2", "*", ['Limit' => 3, 'Select' => '922']);
foreach ($results as $r) {
    var_dump($r);
}
</pre></code>

它返回错误: [11-Mar-2017 06:32:59 America / New_York] PHP致命错误:未捕获异常&#39; PHRETS \ Exceptions \ RETSException&#39; with message&#39;在子查询中缺少左括号。参考编号:fc63ca3e-c8a8-44cf-a0ce-4c729ce91fcc&#39;在/home2/XXXX/vendor/troydavisson/phrets/src/Session.php:379 堆栈跟踪:

0 /home2/XXXX/vendor/troydavisson/phrets/src/Session.php(297):PHRETS \ Session-&gt; request(&#39; Search&#39;,Array)

1 /home2/XXXX/index.php(34):PHRETS \ Session-&gt;搜索(&#39;属性&#39;,&#39; 2&#39;,&#39; *&#39 ;,数组)

2 {main}

在第379行的/home2/XXXX/vendor/troydavisson/phrets/src/Session.php中抛出

1 个答案:

答案 0 :(得分:1)

使用星号执行RETS搜索只是少数服务器支持的。在所有其他情况下,需要给出一个用括号括起来的普通查询。

您可以在RETS使用的查询结构中看到本教程的简要介绍:

https://www.flexmls.com/developers/rets/tutorials/dmql-tutorial/

对于那个特定的服务器,一个让你前进的例子可能是:

  

(SYSID = 0 +)