I am using this php script to get the result from a simple search query documented here
And I have downloaded this excel file of metadata of property here
$rets_login_url = "http://sef.rets.interealty.com/Login.asmx/Login";
$rets_username = "xxxxxxxx";
$rets_password = "xxxxxxxx";
$rets_user_agent = "PHRETS/1.0";
$rets_user_agent_password = "xxxxxxx";
//////////////////////////////
// start rets connection
$rets = new phRETS;
// Uncomment and change the following if you're connecting
// to a server that supports a version other than RETS 1.5
$rets->AddHeader("RETS-Version", "RETS/1.5");
$rets->AddHeader("User-Agent", $rets_user_agent);
echo "+ Connecting to {$rets_login_url} as {$rets_username}<br>\n";
$connect = $rets->Connect($rets_login_url, $rets_username, $rets_password, $rets_user_agent_password);
// check for errors
if ($connect) {
echo " + Connected<br>\n";
}
else {
echo " + Not connected:<br>\n";
print_r($rets->Error());
exit;
}
$search = $rets->SearchQuery("Property","ResidentialProperty","(ListDate=1990-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);
echo "+ Disconnecting<br>\n";
$rets->Disconnect();
when I run this script it shows the result connected and then disconnected. But no result is found. I tried many things suggested on some questions for which result was not showing, But nothing is working for me. Where I am wrong?
My RETS server information are here:
RETS Server: SEF RETS System RETS System ID: SEFRETS Login URL: http://sef.rets.interealty.com:80/Login.asmx/Login RETS Version: 1.5 Server Software: Microsoft-IIS/6.0
I also could not understand what is $rets_modtimestamp_field = "LIST_87";
Please Help me. I need some suggestion over how to get data from the RETS.
The issue is with the parameters in your SearchQuery.
One of the fields in your search query is ListDate. Looking at the attached excel file containing the metadata, "ListDate" is in Column B under StandardNames. The RETS specification uses System Names as default (see below). You need to specify '"StandardNames" => 1' in the options parameter in the SearchQuery function:
$search = $rets->SearchQuery("Property","ResidentialProperty","(ListDate=1990-01-01+)",array("StandardNames" => 1));
Also, check to make sure the second argument, class, of your SearchQuery is correct. To do this you could use the GetMetadataClasses function in PHRETS. You could also use retsmd.com by logging in with your RETS Server url, username, and password.
The $rets_modtimestamp_field is the field which is a datetime value indicating the date and time when a listing was last modified.
In section 7.4.7 in the RETS 1.7.2 Specification document, http://www.reso.org/assets/RETS/Specifications/rets_1_7_2.pdf,
"Queries may use either standard names or system names in the query (Section 7.7). If the client chooses to use standard names, it MUST indicate this using the StandardNames argument...If this entry is set to ("0") or is not present the field names passed in the search are the SystemNames, as defined in the metadata."