Getting images from CRMLS

166 views
Skip to first unread message

Eric Culus

unread,
May 28, 2020, 5:03:22 AM5/28/20
to PHRETS
Hello,

I know this is a returning question, but did anybody solve how to download the images from CRMLS.

Tried the following to drill down the issues:
$rets->Search("Media","Media","MediaKey=$ListingKey");

Gets me Fatal error: Uncaught PHRETS\Exceptions\RETSException: Internal SQL error: Conversion failed when converting from a character string to uniqueidentifier. in E:\Soft\Zend\ZendServer\data\apps\http\crmls.local\80\_docroot_\vendor\troydavisson\phrets\src\Session.php o
n line 424

--
$rets->Search("Media","Media","((MediaKey=$ListingKey), (MediaType=Image))");

Gets me Fatal error: Uncaught PHRETS\Exceptions\RETSException: Internal SQL error: Conversion failed when converting from a character string to uniqueidentifier. in E:\Soft\Zend\ZendServer\data\apps\http\crmls.local\80\_docroot_\vendor\troydavisson\phrets\src\Session.php o
n line 424

--
$rets->GetObject( $objectResource, $objectType, $ListingKey, $photoNumber, 0 );

Gets me
 [error:protected] => PHRETS\Models\RETSError Object
                        (
                            [code:protected] => 20401
                            [message:protected] => Invalid Type
                        )

--
$rets->GetObject( $objectResource, $objectType, $ListingKey, $photoNumber, 1 );

Gets me
[error:protected] => PHRETS\Models\RETSError Object
                        (
                            [code:protected] => 20401
                            [message:protected] => Invalid Type
                        )

--
$rets->Search("Media","Media","((MediaKey=$ListingKey), (MediaType=Image))", array('Limit' => 'none', 'Select' => "MediaOrder,MediaURL"));

Gets me
Fatal error: Uncaught GuzzleHttp\Exception\ServerException: Server error: `GET https://pt.rets.crmls.org/contact/rets/search?SearchType=Media&Class=Media&Query=%28%28MediaKey%3D629309%29%2C%20%28MediaType%3DImage%29%29&QueryType=DMQL2&Count=1&Format=COMPACT-DECODED
&Limit=none&StandardNames=0&Select=MediaOrder%2CMediaURL` resulted in a `500 Internal Server Error` response:

--
So I am bit out of fresh ideas :)

Thanks
Eric

Wade Berlin

unread,
May 28, 2020, 7:37:10 AM5/28/20
to phr...@googlegroups.com
Hello,
The 500 error from them basically means ‘you didn’t do it right and we are not going to help’

CRMLS doesn’t have an objet to get. You have to make a search request to the media class for the listing, I grab all of the listings first, than query my table for missing listing images and then build a loop to grab the ones I need:

For results as $listing

 /** obtain all the image urls for this listing. */
 $actualCount = 0;
 $thequery = array();
 $thequery[] = "(ResourceRecordKeyNumeric=" . $listing['sysid'] . ")";
 $thequery[] = "(MediaType=Image)";
 $query = implode(",", $thequery);

 /** PHRETS v2 Retrieval */
 /** Set the options */
 $options = [];
 $options['Limit'] = 80;
 $options['QueryType'] = 'DMQL2';
 $options['Count'] = 1;
 $options['Format'] = 'COMPACT-DECODED';
 $options['Offset'] = 0;
 $options['StandardNames'] = 0;
 $results = $rets->Search('Media', 'Media', $query, $options);
 $Aresults = $results->toArray();
 $search_rows = count($Aresults);


CRMLS is one of my least favorite feeds to play with, to be honest.


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/phrets/849d0652-eefa-49b8-beb5-4295ff4d8317%40googlegroups.com.


Thank you for your time, 
Wade Berlin, Technical Services
Broker IDX Sites, Inc - www.brokeridxsites.com
1-800-557-8193  9:00am - 6:00pm EDT
eMail:  Sup...@brokerIDXsites.com
Creative and Affordable Technology for the Real Estate Professional

Reply all
Reply to author
Forward
0 new messages