Download all photos from mls server

2,663 views
Skip to first unread message

Karuna

unread,
Nov 30, 2010, 2:12:56 AM11/30/10
to PHRETS
Hello,

We are developing a website to get mls listings from mls server. That
server doesn't support getting url for photos so we are downloading
photos along with listing using GetObject. But, it is giving timeout
when there are many results. So, what we are planning is to download
all photos and store them locally and show from local instead of
reading from mls. so, I want to know if there is anyway to get all
photos from mls server? And also is there anyway to get only changed/
newly uploaded photos from mls server on a daily basis. What we are
planning is get all photos initially from mls and then schedule a job
to run a script to get only updated and newly uploaded photos from
mls.

Thanks and Regards,
Karuna.

Troy Arnold

unread,
Nov 30, 2010, 4:25:48 PM11/30/10
to phr...@googlegroups.com

Hi-

I'm not sure of the capabilities of various RETS servers, but on the
two projects I've worked on my flow was something like:

* Grab all the listings
* Iterate over the list, grabbing all the photos -- throttling and
re-trying the request if necessary.
* When a listing changes, delete all photos and grab all the photos
for that listing again.

I didn't see a way to determine new/modified photos and when I asked the
administrator of the RETS server I worked with told me that the above was
their preferred method for acquiring photos.

Here is a snippet of my quick-n-dirty code which ended up being just clean
enough to keep using :)

$rs = $dbh->execute($sql); #returns the mlsID and RETS key for modified listings
while (!$rs->EOF ) {
$mlsID=$rs->fields['mlsID'];
$retsID=$rs->fields['retsID'];
$digit = substr($mlsID,-1,1);
$outputDir = "$dataDir/images";
RDEBUG("Property: $mlsID $retsID $digit",1);
$photos = $rets->GetObject("Property", "Photo", $retsID);
foreach ($photos as $photo) {
$listing = $photo['Content-ID'];
$number = $photo['Object-ID'];

if ($photo['Success'] == true) {
file_put_contents("$outputDir/{$mlsID}_{$number}.jpg",
$photo['Data']);
} else {
RDEBUG(sprintf("$listing - $number: %s =
%s",$photo['ReplyCode'], $photo['ReplyText']),1);
}
}
$rs->movenext();
}

-t

Warren Bowley

unread,
Nov 30, 2010, 6:11:25 PM11/30/10
to phr...@googlegroups.com
Some RETS servers may have a lastimgtransdate field. This will
contain the date/time that the last image was transmitted. You
*could* use that, but if you delete images when a listing expires,
then you will have problems if it's reactivated because the
lastimagetransdate will typically be outside of your download window.

> --
> You received this message because you are subscribed to the Google Groups "PHRETS" group.
> To post to this group, send email to phr...@googlegroups.com.
> To unsubscribe from this group, send email to phrets+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/phrets?hl=en.
>
>

Karuna

unread,
Dec 2, 2010, 2:55:21 PM12/2/10
to PHRETS
Hello, Thank you for your quick response. I have another question
related to lookup values of the fields. For some of the listing data,
there are some lookup values that are coming in listing details. For
example, for ListingStatus, I see in the Property metadata that it is
a lookup type and from the results I see that it has values 'Active',
'BackOnMarket','PriceChange' etc.. But, these lookup values I could
get by seeing the data in listings retrieved from MLS server. So, now
if I want to see all possible lookup values for a field how can I do
that? metadata of that field only says that it is a lookup type field
but doesn't say anything about the values of lookup. BTW, there is a
LookupName in metadata specified but I couldn't find a way to get all
lookup values based on this lookup name. Please let me know if you
have any idea of this. Thanks in Advance.

Best Regards,
Karuna.

Karuna

unread,
Dec 2, 2010, 2:56:20 PM12/2/10
to PHRETS
Thank you but in our RETS server, I don't find that field.
> > For more options, visit this group athttp://groups.google.com/group/phrets?hl=en.- Hide quoted text -
>
> - Show quoted text -

Dusko O

unread,
Dec 2, 2010, 3:55:46 PM12/2/10
to phr...@googlegroups.com

$rets = new phRETS;

...

$values = $rets->GetLookupValues($Resource, $Field);


You can find details in phRETS docs.


Troy Davisson

unread,
Dec 2, 2010, 4:34:22 PM12/2/10
to phr...@googlegroups.com
The easiest way is to use www.retsmd.com to see all of that.

If you need to do it yourself, it requires a few steps.

1) Pull the table metadata for the class you're interested in
2) Find the LookupName for the field you want the lookups for
3) $values = $rets->GetLookupValues($resource, $that_LookupName_value_you_found);

If you want to grab all lookup values for all fields in one shot, you can use GetAllLookupValues.



Reply all
Reply to author
Forward
0 new messages