Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

SearchQuery

troydavisson edited this page · 2 revisions

SearchQuery

SearchQuery ( string $resource, string $class, string $query [, array $options] )

Parameters

$resource - RETS Resource. Example values: Property, Office, Agent. See GetMetadataResources to learn the available resources of a RETS server.
$class - RETS Class. See GetMetadataClasses to learn the available classes of a RETS server.
$query - DMQL query passed to the server.
$options - Optional. Associative array of parameters which represent name-value pairs of RETS Search settings. See RETS specification for specific options.

Return Value

String. The value of the string must be passed to FetchRow and FreeResult to identify which resultset to use.

Changelog

1.0 - New function

Usage Examples

Search all residential properties where the Listing Date is 01/01/1990 or after

<?php
$search = $rets->SearchQuery("Property","RES","(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);
Address: 83 Fox Hill, Buffalo Grove, IL 60089 listed for $380,000
Address: 1250 Armitage Ave, Chicago, IL 60613 listed for $250,000
Address: 430 Michigan Ave, Chicago, IL 60605 listed for $300,000
Address: 625 Michigan, Chicago, IL 60605 listed for $250,000
Address: 120 Main St, Evanston, IL 60533 listed for $425,000

Everything plus the kitchen sink

<?php
$search = $rets->SearchQuery("Property","ResidentialProperty","(ListDate=1990-01-01+)",
array( "Count" => 1, "Format" => "COMPACT", "Limit" => "2", "Offset" => "2",
"Select" => "StreetNumber,StreetName,ListPrice,City,StateOrProvince,PostalCode",
"RestrictedIndicator" => "****", "StandardNames" => 1 )
);
while ($listing = $rets->FetchRow($search)) {
        echo "Address: {$listing['StreetNumber']} {$listing['StreetName']}, ";
        echo "{$listing['City']}, ";
        echo "{$listing['StateOrProvince']} {$listing['PostalCode']} listed for ";
        echo "\$".number_format($listing['ListPrice'])."\n";
}
$rets->FreeResult($search);
Address: 1250 Armitage Ave, Chicago, IL 60613 listed for $250,000
Address: 430 Michigan Ave, Chicago, IL 60605 listed for $300,000

Search all residential properties where the Listing Date between 03/02/2010 and 03/03/2010 inclusively

<?php
$search = $rets->SearchQuery("Property","RES","(ListDate=2010-03-02-2010-03-03)");
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);
Address: Maluawai St, Pearl City, HI 96782 listed for $574,900
Address: Iosepa St, Laie, HI 96762 listed for $350,000
Address: Keaunui Dr, Ewa Beach, HI 96706 listed for $420,000
Address: Kamohoalii St, Honolulu, HI 96819 listed for $425,000
Address: 10th Ave, Honolulu, HI 96816 listed for $439,000
Address: Kahuhipa St, Kaneohe, HI 96744 listed for $749,000
Address: Kuaeewa Pl, Ewa Beach, HI 96706 listed for $409,000
Address: Alawiki St, Kaneohe, HI 96744 listed for $460,000
Address: Iosepa St, Laie, HI 96762 listed for $400,000
Address: Kanapuu Dr, Kailua, HI 96734 listed for $939,000
Address: California Ave, Wahiawa, HI 96786 listed for $450,000
Address: Moana St, Laie, HI 96762 listed for $349,900
Address: Kaipoi St, Waianae, HI 96792 listed for $400,000
Address: Akolo Pl, Kapolei, HI 96707 listed for $419,000
Address: Lehiwa Dr, Mililani, HI 96789 listed for $929,000
Address: Aukai Ave, Honolulu, HI 96816 listed for $5,650,000
Address: Mokapu Blvd, Kailua, HI 96734 listed for $869,000
Address: Aikanaka Rd, Ewa Beach, HI 96706 listed for $425,000
Address: Kapakai Pl, Waianae, HI 96792 listed for $385,000
Address: Hapaki St, Aiea, HI 96701 listed for $875,000
Address: Hoomahana St, Ewa Beach, HI 96706 listed for $780,000
Address: Moaniala St, Honolulu, HI 96821 listed for $1,899,000
Address: Winam Ave, Honolulu, HI 96815 listed for $1,100,000
Address: Lewalani Dr, Honolulu, HI 96822 listed for $950,000
Address: Ohepio Pl, Waipahu, HI 96797 listed for $595,000
Address: Elele St, Kapolei, HI 96707 listed for $475,000
Address: Kamehameha Ave, Kahului, HI 96732 listed for $415,000
Address: California Ave, Wahiawa, HI 96786 listed for $799,000
Address: Moaniala Pl, Honolulu, HI 96821 listed for $1,650,000
Address: Ualakupu St, Kapolei, HI 96707 listed for $320,000
Address: Halekou Rd, Kaneohe, HI 96744 listed for $550,000
Related To

FetchRow, FreeResult, NumRows, TotalRecordsFound, IsMaxrowsReached

Something went wrong with that request. Please try again.