MOON
Server: Apache
System: Linux 3-228-103-98.cprapid.com 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64
User: api (1001)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /home/api/public_html/nashville/get-price-reductions.php
<?php
//ini_set( "display_errors", true );
//ini_set( "display_startup_errors", true );
require( "php/config.php" );
$iLimit = false;
$iStartDate = false;
$iEndDate = false;
foreach ( $_GET as $k => $v )
{
	switch( strtolower( $k ) )
	{
		case "startdate":
			if ( is_numeric( $v ) )
				$iStartDate = $v;
			break;
		case "enddate":
			if ( is_numeric( $v ) )
				$iEndDate = $v;
			break;
		case "limit":
			if ( is_numeric( $v ) )
				$iLimit = $v;
	}
}

$oRes = new Result( "PriceReductions" );
if ( ! $iStartDate )
	$oRes->FatalError( "Start Date is not valid" );

if ( $iLimit )
{
	$oMLS->setLimit( $iLimit );
	$oRes->setLimit( $iLimit );
}

$tmp = $oMLS->getPriceReductions( $iStartDate, $iEndDate );
if ( $tmp )
{
	$oRes->addData( $tmp['TotalRecords'], "TotalRecords" );
	$oRes->addData( $tmp['Data'], "Data" );
}
else $oRes->addError( "AgentID '" . $sAgentID . "' is not valid." );

$oMLS->finish( "nashville", "price-reductions", json_encode( $_GET ) );

print $oRes->getJSON();