PHP Fatal error: Uncaught exception 'PHRETS\Exceptions\RETSException' with message 'Miscellaneous Search Error' in /home4/scotteng/public_html/vendor/troydavisson/phrets/src/Session.php:379 Stack trace: #0 /home4/scotteng/public_html/vendor/troydavisson/phrets/src/Session.php(297): PHRETS\Session->request('Search', Array) #1 /home4/scotteng/public_html/test-search-results.php(23): PHRETS\Session->Search('OffMarket', 'OffMarket', 'ListingStatusID...', Array) #2 {main} thrown in /home4/scotteng/public_html/vendor/troydavisson/phrets/src/Session.php on line 379
The code that I'm using for test purposes is just a simple list:
$resource = "OffMarket";
$class = "OffMarket";
$object_type = "Photo";
$table_name = "rets_".strtolower($resource)."_".strtolower($class);
$query = "ListingStatusID=3";
$rets_metadata = $rets->GetTableMetadata($resource, $class);
$results = $rets->Search(
$resource,
$class,
$query,
[
'QueryType' => 'DMQL2',
'Count' => 1, // count and records
'Format' => 'COMPACT-DECODED',
'Limit' => 999999,
'StandardNames' => 0, // give system names
]
);
echo "Number of results: " . $results->getTotalResultsCount() . "<br/>";
foreach ($results as $record) {
$mls_num = $record->get('MlsNum');
echo $mls_num;
}
Any advice?
--
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.
--
$sql = "SELECT * FROM `rets_property_res`"; $property = $conn->query($sql); if ($property->num_rows > 0) { while($row = $property->fetch_assoc()) { $mls_num = $row['MlsNum']; $query = "MlsNum=" . $mls_num; $results = $rets->Search( $resource, $class, $query, [ 'QueryType' => 'DMQL2', 'Count' => 1, // count and records 'Format' => 'COMPACT-DECODED', 'Limit' => 999999, 'StandardNames' => 0, // give system names ] ); $num_results = $results->getTotalResultsCount(); if($num_results = 0) { echo $mls_num . " is not active - "; $sql = "DELETE FROM `" . $table_name . "WHERE `MlsNum`=" . $record->get('MlsNum'); if ($conn->query($sql) == TRUE) { echo "deleted successfully <br/>"; } else { echo "Error: " . $conn->error; } } else { echo $mls_num . " is active<br>"; } }} $resource = "Property"; $class = "RES"; $table_name = "rets_".strtolower($resource)."_".strtolower($class); $query = "ListingStatusID=1"; $rets_metadata = $rets->GetTableMetadata($resource, $class); $maxrows = true; $offset = 1; $limit = 250; $mls_array = array(); while ($maxrows) { $results = $rets->Search( $resource, $class, $query, [ 'QueryType' => 'DMQL2', 'Count' => 1, // count and records 'Format' => 'COMPACT-DECODED', 'Limit' => $limit, 'Offset' => $offset, 'StandardNames' => 0, // give system names ] ); if ($results->getReturnedResultsCount() > 0) { foreach ($results as $record) { $mls_num = $record->get('MlsNum'); $mls_array[$mls_num] = TRUE; } $offset = ($offset + $results->getReturnedResultsCount()); } $maxrows = $results->isMaxRowsReached(); echo "Total results: {$results->getTotalResultsCount()}<br>\n"; } print_r($mls_array);[15-Jan-2016 13:31:44 America/Denver] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /home4/scotteng/public_html/vendor/guzzlehttp/ringphp/src/Client/CurlMultiHandler.php on line 133 [15-Jan-2016 13:31:44 America/Denver] PHP Warning: (null)(): 206 is not a valid cURL handle resource in Unknown on line 0
MlsNum'
You might also need to grab the unique id, not sure.
--
$maxrows = true; $offset = 1; $limit = 250; while ($maxrows) { $results = $rets->Search( $resource, $class, $query, [ 'QueryType' => 'DMQL2', 'Count' => 1, // count and records 'Format' => 'COMPACT-DECODED', 'Limit' => $limit, 'Offset' => $offset, 'StandardNames' => 0, // give system names 'Select' => 'MlsNum' ] ); if ($results->getReturnedResultsCount() > 0) { foreach ($results as $record) { $sql = "INSERT INTO Active_Listings (MlsNum) VALUES (" . $record->get('MlsNum') . ")"; if ($conn->query($sql) === TRUE) { echo "MLS Num " . $record->get('MlsNum') . " added to Active_Listings. </br>"; } else { echo "Error updating table: " . $conn->error; } } $offset = ($offset + $results->getReturnedResultsCount()); } $maxrows = $results->isMaxRowsReached(); } $sql = "DELETE FROM {$table_name} WHERE 'MlsNum' NOT IN (SELECT MlsNum FROM Active_Listings)"; if ($conn->query($sql) === TRUE) { echo "Complete"; }
$sql = "TRUNCATE TABLE Active_Listings"; if ($conn->query($sql) === TRUE) { echo "Active_Listings emptied."; } $resource = "Property"; $class = "RES"; $table_name = "rets_".strtolower($resource)."_".strtolower($class); $query = "ListingStatusID=1"; $rets_metadata = $rets->GetTableMetadata($resource, $class); $maxrows = true; $offset = 1; $limit = 250; $mls_array = array(); while ($maxrows) { $results = $rets->Search( $resource, $class, $query, [ 'QueryType' => 'DMQL2', 'Count' => 1, // count and records 'Format' => 'COMPACT-DECODED', 'Limit' => $limit, 'Offset' => $offset, 'StandardNames' => 0, // give system names 'Select' => 'MlsNum' ] ); if ($results->getReturnedResultsCount() > 0) { foreach ($results as $record) { $mls_num = $record->get('MlsNum'); $mls_array[$mls_num] = TRUE; } $offset = ($offset + $results->getReturnedResultsCount()); } $maxrows = $results->isMaxRowsReached(); } $sql = "SELECT `MlsNum` FROM " . $table_name; $check = $conn->query($sql); if ($check->num_rows > 0) { while($row = $check->fetch_assoc()) { $mls_num = $row['MlsNum']; if(!array_key_exists($mls_num, $mls_array)) { echo "#" . $mls_num . " is NOT active.</br>"; $sql = "DELETE FROM " . $table_name . " WHERE `MlsNum` = " . $mls_num; if ($conn->query($sql) === TRUE) { echo "Successfully deleted.</br>"; } else { echo "Error updating table: " . $conn->error; } } } } echo "</br>" . $table_name . " updated to only active listings.";