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?
Partially possible, but then currently can't download entire photos along with properties in a single query.
We can download multiple listing's images in a single query. Check the sample query below.
Here 3rd parameter we can provide comma separated listingIds. Thereby you can pass the listingIds as batches.
Note: Still MLS holds the extraction speed. Some MLS boards may increase the bandwidth temporarily on request. Within that time try to extract full images.