troydavisson / PHRETS

PHP client library for interacting with a RETS server to pull real estate listings, photos and other data made available from an MLS system
http://troda.com
MIT License
451 stars 234 forks source link

How to get the content_id #191

Open lillorme opened 6 years ago

lillorme commented 6 years ago

@troydavisson I'm new to PHRETS and I would like to know how would I get the content_id to place in the action below $photos = $rets->GetObject("Property", "Photo", "$content_ids", "*", 1);

quinncomendant commented 4 years ago

The third parameter to GetObject should be the Property Key Field, usually the one with a SystemName of ListingID. You should be able to use something like this:

$results = $rets->Search($resource, $class, $query, $params);
foreach ($results as $r) {
    printf("ListingID: %s\n", $r->get('ListingID'));
    $photos = $rets->GetObject('Property', 'Photo', $r->get('ListingID'), '*', 1);
    foreach ($photos as $p) {
        printf("Photo %s: %s\n", $p->getObjectId(), $p->getLocation());
    }
}
parteek-sdm commented 2 years ago

@quinncomendant The above code is not working.

quinncomendant commented 2 years ago

@parteek-sdm You might need to customize the key names, they'll be different for each RETS API.

Try retsmd.com – Use it to log in to your MLS to get a LIVE data dictionary and schema, which you need to know to communicate with the API correctly.