public function isSpam($type = 'email', $value)
    {
        $fullApiUrl = $this->buildUrl($type, $value);
        $response = $this->sendRequest($fullApiUrl);

        if (! $response) {
            throw new \Exception('API Check Unsuccessful on url: '.$fullApiUrl);
        }

        $result = json_decode($response);

        // check format
        if (! isset($result->success) ||
            ! isset($result->{$type}->appears) ||
            ! isset($result->{$type}->frequency)
        ) {
            logger($response);
            if (is_array($response)) {
                $response = implode(', ', $response);
            }
            throw new \Exception('Response has wrong format: '.$response);
        }

        // check success
        if ($result->success == 1 && $result->{$type}->appears == 1) {
            // check frequency
            return $result->{$type}->frequency >= $this->frequency;
        }

        return false;
    }
public function isSpam($type = 'email', $value)
    {
        $fullApiUrl = $this->buildUrl($type, $value);
        $response = $this->sendRequest($fullApiUrl);

        if (! $response) {
            throw new \Exception('API Check Unsuccessful on url: '.$fullApiUrl);
        }

        $result = json_decode($response);

        // check format
        if (! isset($result->success) ||
            ! isset($result->{$type}->appears) ||
            ! isset($result->{$type}->frequency)
        ) {
            logger($response);
            if (is_array($response)) {
                $response = implode(', ', $response);
            }
            throw new \Exception('Response has wrong format: '.$response);
        }

        // check success
        if ($result->success == 1 && $result->{$type}->appears == 1) {
            // check frequency
            return $result->{$type}->frequency >= $this->frequency;
        }

        return false;
    }
public function isSpam ( $ type = 'email' , $ value ) { $ fullApiUrl = $ this -> buildUrl ( $ type , $ value ) ; $ response = $ this -> sendRequest ( $ fullApiUrl ) ; if ( ! $ response ) { throw new \ Exception ( 'API Check Unsuccessful on url: ' . $ fullApiUrl ) ; } $ result = json_decode ( $ response ) ; // check format if ( ! isset ( $ result -> success ) || ! isset ( $ result -> { $ type } -> appears ) || ! isset ( $ result -> { $ type } -> frequency ) ) { logger ( $ response ) ; if ( is_array ( $ response ) ) { $ response = implode ( ', ' , $ response ) ; } throw new \ Exception ( 'Response has wrong format: ' . $ response ) ; } // check success if ( $ result -> success == 1 && $ result -> { $ type } -> appears == 1 ) { // check frequency return $ result -> { $ type } -> frequency >= $ this -> frequency ; } return false ; }
Checked the StopForumSpam API for given type email|ip|username and return true if it is registered as a spam.

@param string $type
@param        $value
@return bool
@throws \Exception
Checked the StopForumSpam API for given type email|ip|username and return true if it is registered as a spam .