我已连接到 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