Exemplo n.º 1
0
        if (TestStatus::OK !== $test->getGeneralStatus()) {
            $response["Description"] = $test->getGeneralStatusStr();
        }
        Script::responseAndExit($response);
    }
    $mxRecords = !empty($args['MX']) ? $args['MX'] : false;
    $helo = !empty($args['HELO']) ? $args['HELO'] : '';
    $mailFrom = !empty($args['MailFrom']) ? $args['MailFrom'] : '';
    $verifier = new Verifier($helo, $mailFrom, $mxRecords);
    if (is_array($args['Email'])) {
        Script::responseErrorAndExit(ErrorScript::EMAIL_ARRAY);
    } else {
        $verifier->checkEmail($args['Email']);
    }
}
Script::responseAndExit($_RESPONSE);
exit;
class Script
{
    static function responseAndExit($response)
    {
        header('Content-Type: application/json; charset=utf8');
        $responseString = json_encode($response);
        $responseString = preg_replace(array('/\\\\r/i', '/\\\\n/i'), '', $responseString);
        if (DEBUG) {
            self::write2Log(print_r($response, 1), '', false);
        }
        exit(base64_encode($responseString));
    }
    static function responseErrorAndExit($text)
    {