I can't seem to get the SearchQuery() function in phrets to return anything. I know my Resouce and Class. I also know the sysid of the field name I'm using in the query.
Here is my code
<?php @include_once('login.php'); ?>
<pre>
<?php
$rets = new PHRETS;
$rets->AddHeader("User-Agent", $rets_user_agent);
/* Connect */
$connect = $rets->Connect($rets_login_url, $rets_username, $rets_password, $rets_user_agent_password);
if($connect) {
/*resources*/
$resources = $rets->GetMetadataResources();
foreach ($resources as $resource) {
echo "+ Resource {$resource['ResourceID']} described as " . $resource['Description'] . "\n";
}
/*get classes*/
$classes = $rets->GetMetadataClasses("Property");
foreach ($classes as $class) {
echo "+ Class {$class['ClassName']} described as " . $class['Description'] . "\n";
}
/*get fields*/
$fields = $rets->GetMetadataTable("Property", 1);
print_r ($fields);
/* Search RETS server */
$search = $rets->SearchQuery("Property",1,"(135=2013-01-01+)");
while ($listing = $rets->FetchRow($search)) {
echo "Address: {$listing['StreetNumber']} {$listing['StreetName']}, ";
echo "{$listing['City']}, ";
echo "{$listing['State']} {$listing['ZipCode']} listed for ";
echo "\$".number_format($listing['ListPrice'])."\n";
}
$rets->FreeResult($search);
$rets->Disconnect();
} else {
$error = $rets->Error();
print_r($error);
}
?>
</pre>
I used the GetMetadataResources()
and GetMetadataClasses()
to get the resource name and property names. I used GetMetadataTable("Property", 1)
to get the sysid of the fields. I use the sysid for 'ListDate' to use in my query. I must be doing something wrong.
You can see the live page here http://miamiheatfan.com/phrets/example5.php
Thanks