Ask Your Question

Revision history [back]

Using this script and your information I was able to download without issue:

date_default_timezone_set('America/Denver');
ini_set('memory_limit','16384M');
ini_set("default_socket_timeout", 6000); // seconds

require_once("vendor/autoload.php");

error_reporting(E_ALL & ~E_NOTICE);

$config = new \PHRETS\Configuration;

$config->setLoginUrl('http://gbhar-rets.paragonrels.com/rets/fnisrets.aspx/GBHAR/login')
->setUsername('ailchuk')
->setPassword('**')
->setRetsVersion('1.7.2');

//$config->setHttpAuthenticationMethod('digest'); // HTTP use 'digest'
//$config->setHttpAuthenticationMethod('basic'); // HTTPS use 'basic'

//var_dump($config);


$rets = new \PHRETS\Session($config);
//var_dump($rets);

try {
$connect = $rets->Login();
//var_dump($connect);
} catch (Exception $e)
{
echo "Login failed\n";
echo "Error: " . $e->getMessage() . "\n";
return;
}

// $system = $rets->GetSystemMetadata();
// var_dump($system);

$query = "(ListingID=0+)";
$select = 'ListingID,ListPrice';

try {

echo "\n";
$results = $rets->Search('Property', 'RE_1', $query, ['Limit' => 1, 'Count' => 2]);
$recordCount = $results->getTotalResultsCount();
echo "Record Count: {$recordCount}\n\n";

$results = $rets->Search('Property', 'RE_1', $query,
[
'QueryType' => 'DMQL2',
'Count' => 1,
'Format' => 'COMPACT',
'Limit' => 5,
'StandardNames' => 1,
'Select' => $select,
]);

echo "Search Results:" . "\n";
foreach ($results as $r) {
var_dump($r);
}

} catch (Exception $e)
{
echo "Search failed \n";
echo "Error: " . $e->getMessage() ."\n";
}

try {
$rets->Disconnect();
echo "\n";
echo "Logout" . "\n";
} catch (Exception $e)
{
echo "Logout failed\n";
echo "Error: " . $e->getMessage() . "\n";
}