0

我已连接到 RETS 服务器,我能够使用 PHrets 库中的函数获取所有元数据,例如 GetMetadataResources、GetMetadataClasses 以及每个类中的所有字段,但我无法使用 SearchQuery 从该服务器获取数据,我尝试了各种方式,但是没运气。

<pre>
    /* Initialize Object */
 require("PHRets_CREA.php");
require("credentials.php");
$rets = new PHRets();
$connect=$rets->Connect($RETSURL, $RETSUsername, $RETSPassword);
    /* Connect */
    /* Query Server */
    if ($connect) {
        echo "Connected";
$resources = $rets->GetMetadataResources();
foreach ($resources as $resource) {
        echo "+ Resource {$resource['ResourceID']}\n";
        $classes = $rets->GetMetadataClasses($resource['ResourceID']);
        foreach ($classes as $class) {
                echo "   + Class {$class['ClassName']} described as " . $class['Description'] . "\n";
        $rets_metadata = $rets->GetMetadata($resource['ResourceID'],$class['ClassName']);
        foreach ($rets_metadata as $field) {
            echo "    + Field: {$field['SystemName']} ({$field['DataType']})\n";
        }
        }
}
/*
$search = $rets->SearchQuery("Property","RE_1","(L_ListingDate=2010-03-02-2010-03-03)");
while ($listing = $rets->FetchRow($search)) {
  echo $listing['L_ListingID'];
        }*/
$search = $rets->SearchQuery("Property","ResidentialProperty","(ListDate=1990-01-01+)",
array( "Count" => 1, "Format" => "COMPACT", "Limit" => "2", "Offset" => "2",
"RestrictedIndicator" => "****", "StandardNames" => 1 )
);
echo "data";
print_r($search);
while ($listing = $rets->FetchRow($search)) 
 echo "{$listing['L_City']}";exit; 
}
$rets->FreeResult($search);
}</pre>

Thanks
4

2 回答 2

0

请试试这个,我们得到了所有的活动属性。

$search = $rets->SearchQuery("属性","1","(135=1990-01-01+),(246=A)");

于 2015-12-22T13:16:11.850 回答
0

首先确保您的资源和类名称是正确的。使用http://retsmd.com进行验证。资源通常是“属性”,但请检查您当前必须为“住宅属性”的类名称。它可能是您在上述代码中的“RE_1”。

接下来,修改您的 SearchQuery。也许在选项数组中使用更少的参数并尝试删除 StandardNames 并使用默认的系统名称。

像这样的东西:

$search = $rets->SearchQuery("Property","RE_1","(L_ListingDate=1990-01-01+)", array("Limit" => "10"));
于 2015-12-05T20:06:33.273 回答