I would like to download all property listings from a RETS server, including all photo URLs. I'm using DMQL2 and the PHRETS library. Properties and photo objects are stored in the RETS server in different tables.
To get all the photos, I know I can download the list of properties, then loop through each and retrieve the photos for each property like this:
$results = $rets->Search($resource, $class, $query);
foreach ($results as $r) {
$photos = $rets->GetObject('Property', 'Photo', $r->get('ListingID'), '*', 1);
foreach ($photos as $p) {
// Save the photo locations somewhere…
}
}
This is incredibly slow because there are many thousands of properties.
Is it possible to request all photos along with properties in a single query by joining the property and object tables (like a LEFT JOIN
in MySQL)?
Or, is there a way to download all photo objects in one request, so I can correlate them to properties using their ListingID key?
Any other suggestions for getting all the data more quickly?