HAR MLS Images (Houston, TX)

238 views
Skip to first unread message

Mariano Iglesias

unread,
Jun 1, 2016, 5:52:02 PM6/1/16
to phr...@googlegroups.com
Hey guys,

Anyone worked with HAR? What's the deal with images? While they do offer RETS Objects (Photo, in particular), when you query all objects for a given property you get nothing.

This is not unheard of, as CRMLS does the same, but provides media images through a different RETS resource / class combination. HAR does this too, offering the MEDIA resource & class.

Querying the MEDIA class for a given MLS number does provide the list of images. However these images are simple file names, no indication as to which URL to download from.

Any ideas?

Christopher Reichert

unread,
Jun 1, 2016, 6:07:48 PM6/1/16
to phr...@googlegroups.com
What field are you using to query /GetObject for a listing? Are you using Location=1?

The KeyField is 'UID' but you should try using 'MLSNUM' to query to media objects directly.

Hope that helps,

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Mariano Iglesias

unread,
Jun 1, 2016, 6:32:40 PM6/1/16
to phr...@googlegroups.com
Location=1 also provides no results.

I figured it out. THe URL to the full image is built using a simple regex out of the actual file name. For example for property with MLS # 20345740 one of the images that are returned after querying the resource MEDIA and class MEDIA with query (MLSNUM=20345740) gives back a record where the file name is here:

'MEDIASOURCE' => string(14) "3750503-10.jpg"

Taking that filename, and extracting the last two digits of the basename (previous to -10, so that means extracting 03), you can build the URL to the high resolution image like so:


Not the best thing on earth (they could've made it so much nicer if they just conformed to RETS objects), but gets the job done

Gennadiy Kofman

unread,
Jun 1, 2016, 9:10:07 PM6/1/16
to PHRETS
How did you figure that out?  Did they provide a document?

Mariano Iglesias

unread,
Jun 1, 2016, 9:22:14 PM6/1/16
to phr...@googlegroups.com
Nop. Just a little reverse engineering by looking at their web app.

Been downloading images for thousands of properties now without issues

Abhinandan Dev

unread,
Oct 25, 2017, 11:13:10 AM10/25/17
to PHRETS
Hi mariano can you please resolve my problem.
I am not getting images from https://pt.rets.crmls.org/contact/rets/login

I tried
$results = $rets->Search("Media", "Media", "(MediaKey=0+)",
        [
        'QueryType' => 'DMQL2',
        'Count' => 1, // count and records
        'Format' => 'COMPACT-DECODED',
        'Limit' => 1,
        'StandardNames' => 0, // give system names
    ]);

Barclay Berger

unread,
Jun 19, 2018, 12:03:14 PM6/19/18
to PHRETS
Here is how to get images from HAR

$objects = $rets->GetObject("Property", "LargePhoto", "147496590", "*", 1);
foreach ($objects as $object) {
// does this represent some kind of error
$object->isError();
$object->getError(); // returns a \PHRETS\Models\RETSError

// get the record ID associated with this object
$object->getContentId();

// get the sequence number of this object relative to the others with the same ContentId
$object->getObjectId();

// get the object's Content-Type value
$object->getContentType();

// get the description of the object
$object->getContentDescription();

// get the sub-description of the object
$object->getContentSubDescription();

// get the object's binary data
$object->getContent();

// get the size of the object's data
$object->getSize();

// does this object represent the primary object in the set
$object->isPreferred();

// when requesting URLs, access the URL given back
$object->getLocation(); //this is the location for the CDN for the image

// use the given URL and make it look like the RETS server gave the object directly
//$object->setContent(file_get_contents($object->getLocation()));
}
Reply all
Reply to author
Forward
0 new messages