BuildMyWeb Posted November 17, 2014 Share Posted November 17, 2014 i am using PHRETS ( http://dangodesign.net/2013/01/getting-started-with-rets-for-php/ ) to pull data off of a MLS RETS server. i am successfully connecting to the server so the conditional is passing. but my queries are pulling no results. the provider tells me DMQL2 is the database. ive only ever worked with MySQL so im in the dark. if($connect) { $sixmonths = date('Y-m-d\TH:i:s', time()-15778800); // get listings updated within last 6 months /* Search RETS server */ $search = $rets->SearchQuery ( 'Property', // Resource //6, // Class 'ResidentialProperty', '((Lud='.$sixmonths.'+),(Status=A))', // DMQL, with SystemNames array( 'Format' => 'COMPACT-DECODED', 'Select' => 'sysid,49,112,175,9,2302,2304', 'Count' => 1, 'Limit' => 20 ) ); /* If search returned results */ if($rets->TotalRecordsFound() > 0) { while($data = $rets->FetchRow($search)) { print_r($data); } } else { echo '0 Records Found'; } $rets->FreeResult($search); } Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/ Share on other sites More sharing options...
sKunKbad Posted November 18, 2014 Share Posted November 18, 2014 The real problem is that although RETS tries to establish a standard, each MLS server can be configured differently. Also, if you query for something in the DMQL that doesn't belong, you'll get no feedback from the server. It's really a system designed by idiots. If you query for your resources and classes, and you've got those all mapped out, you might also be restricted by the server as to what you have access to. So, that said, all you can really do is keep trying to get some feedback until something works. I'd suggest first trying to access your listing agent's properties, because I've seen where access was restricted like that. Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496844 Share on other sites More sharing options...
sKunKbad Posted November 18, 2014 Share Posted November 18, 2014 You might want to play around with the following methods, just to make sure you are calling the correct class name, and searching for values that are "searchable": * Show the resources and classes */ public function show_resources_and_classes() { if( $this->_connect() ) { return $this->GetMetadataTypes(); } return NULL; } // ----------------------------------------------------------------------- /** * Get the fields in a class */ public function show_class_fields( $resource_name, $class_name ) { if( $this->_connect() ) { return $this->GetMetadataTable( $resource_name, $class_name ); } return NULL; } // ----------------------------------------------------------------------- /** * Show the values that are acceptable to search a specific field by */ public function show_accepted_search_values( $resource_name, $field_name ) { if( $this->_connect() ) { return $this->GetLookupValues( $resource_name, $field_name ); } return NULL; } // ----------------------------------------------------------------------- Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496848 Share on other sites More sharing options...
BuildMyWeb Posted November 18, 2014 Author Share Posted November 18, 2014 (edited) thank you skunk. ive had success with the following method calls: $types = $rets->GetMetadataTypes(); $fields = $rets->GetMetadataTable("Property", 'ResidentialProperty'); $values = $rets->GetLookupValues('Property', 'Status'); so ive got some good info. just cant seem to put it to good use in getting search results. i assumed it was my queries being faulty because i know there are indeed data values. im just not accessing it for some reason. Edited November 18, 2014 by BuildMyWeb Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496852 Share on other sites More sharing options...
sKunKbad Posted November 18, 2014 Share Posted November 18, 2014 (edited) So, for debugging purposes, what happens when you remove all of the conditions? For instance, if all you use for the DMQL is (Status=A), and you remove the limit, count, format, and perhaps even the select options. If you can reduce the call down to the bare minimum and it works (retrieves data) then you would want to reintroduce your options one by one until you find where the hickup is. I recently created a rets class that extends phrets. You can see how I used it here: https://gist.github.com/anonymous/8e678847d4bdfe75a650 Edited November 18, 2014 by sKunKbad Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496853 Share on other sites More sharing options...
BuildMyWeb Posted November 18, 2014 Author Share Posted November 18, 2014 i had stripped the query statement down to the following. still no results: $search = $rets->SearchQuery ( 'Property', // Resource //6, // Class 'ResidentialProperty', // Class //'((Lud='.$sixmonths.'+),(Status=A))', // DMQL, with SystemNames '(Status=A)' // DMQL, with SystemNames //'(Status=A)', // DMQL, with SystemNames //array( //'Format' => 'COMPACT-DECODED', //'Select' => 'sysid,49,112,175,9,2302,2304', //'Count' => 1, //'Limit' => 20 //) ); Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496902 Share on other sites More sharing options...
sKunKbad Posted November 18, 2014 Share Posted November 18, 2014 If you are sure that Status is actually something you can use as a condition, and that A is an acceptable value, then your next step would be to contact the technical department of the organization that your contract for access is through. Be sure to post the solution when you figure it out. The internet has very little information about RETS, so it's up to us to create it. Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496914 Share on other sites More sharing options...
BuildMyWeb Posted November 18, 2014 Author Share Posted November 18, 2014 thanks skunk. the provider isnt familiar with PHRETS and, though pleasant, hasnt been much help yet. im trying on a couple of other communities and contacted the developer directly. will post here if i get a solution. Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1496925 Share on other sites More sharing options...
Solution sKunKbad Posted November 20, 2014 Solution Share Posted November 20, 2014 I'd be willing to play with it, but I'd need access. I know these things are sensitive in nature, as the contract I signed with CRMLS was like 20 pages long. If you PM a username and password I'll give it a shot. If you don't feel comfortable doing that, I totally understand. 1 Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1497047 Share on other sites More sharing options...
BuildMyWeb Posted November 27, 2014 Author Share Posted November 27, 2014 thanks skunk for the help. turns out, i did eventually get a good query going. the RETS db was returning 0 results because we were doing a query on ResidentialProperty and this broker only had commercial and rental listings at the time. Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1497835 Share on other sites More sharing options...
sKunKbad Posted November 30, 2014 Share Posted November 30, 2014 Well that's good to hear. Glad you got it working. Quote Link to comment https://forums.phpfreaks.com/topic/292518-phrets-query-failing/#findComment-1498048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.