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/charlottesville/get-office-listings.php
<?php
$aOfficeIDs = false;
$bSold = false;
$bActive = true;
$iLimit = false;
foreach ( $_GET as $k => $v )
{
    switch( strtolower( $k ) )
    {
        case "officeid":
            if ( preg_match( "@^[[:alnum:],]+$@", $v ) === 1 )
                $aOfficeIDs = explode( ",", $v );
            break;
        case "sold":
            if ( $v === "1" )
                $bSold = true;
            break;
        case "active":
            if ( $v === "1" )
                $bActive = true;
            break;
        case "limit":
            if ( is_numeric( $v ) )
                $iLimit = $v;
    }
}

require( "php/config.php" );

$oRes = new Result( "OfficeListings" );
if ( ! $aOfficeIDs )
    $oRes->FatalError( "OfficeID is not valid" );

$aMLS = array();
foreach ( $aOfficeIDs as $sOfficeID )
{
    $tmp = $oMLS->getPropsByOffice( $sOfficeID );
    if ( $tmp )
    {
        foreach ( $tmp as $prop )
            $oRes->addData( $prop );
    }
    else $oRes->addError( "OfficeID '" . $sOfficeID . "' is not valid." );
}

print $oRes->getJSON();