src/Service/Recaptcha.php
public function recaptcha($response, $ipClient = null)
    {
        if ($this->getOptions()->getGRecaptchaKey()) {
            $client = new \Zend\Http\Client($this->getOptions()->getGRecaptchaUrl());
            $client->setParameterPost(array(
                'secret'  => $this->getOptions()->getGRecaptchaKey(),
                'response' => $response,
                'remoteip'   => $ipClient,
            ));
            $client->setMethod(\Zend\Http\Request::METHOD_POST);
    
            $result = $client->send();
            if ($result) {
                $jsonResult = \Zend\Json\Json::decode($result->getBody());
                if ($jsonResult->success) {
                    return true;
                }
            }
        }

        return false;
    }
public function recaptcha($response, $ipClient = null)
    {
        if ($this->getOptions()->getGRecaptchaKey()) {
            $client = new \Zend\Http\Client($this->getOptions()->getGRecaptchaUrl());
            $client->setParameterPost(array(
                'secret'  => $this->getOptions()->getGRecaptchaKey(),
                'response' => $response,
                'remoteip'   => $ipClient,
            ));
            $client->setMethod(\Zend\Http\Request::METHOD_POST);
    
            $result = $client->send();
            if ($result) {
                $jsonResult = \Zend\Json\Json::decode($result->getBody());
                if ($jsonResult->success) {
                    return true;
                }
            }
        }

        return false;
    }
public function recaptcha ( $ response , $ ipClient = null ) { if ( $ this -> getOptions ( ) -> getGRecaptchaKey ( ) ) { $ client = new \ Zend \ Http \ Client ( $ this -> getOptions ( ) -> getGRecaptchaUrl ( ) ) ; $ client -> setParameterPost ( array ( 'secret' => $ this -> getOptions ( ) -> getGRecaptchaKey ( ) , 'response' => $ response , 'remoteip' => $ ipClient , ) ) ; $ client -> setMethod ( \ Zend \ Http \ Request :: METHOD_POST ) ; $ result = $ client -> send ( ) ; if ( $ result ) { $ jsonResult = \ Zend \ Json \ Json :: decode ( $ result -> getBody ( ) ) ; if ( $ jsonResult -> success ) { return true ; } } } return false ; }
This method calls Google ReCaptcha.
@param  unknown_type $url
@return unknown
This method calls Google ReCaptcha .