Back to HttpBridgePostRequestMethod class

Method submit

public string
submit
(\ReCaptcha\RequestParameters $params)
Submit the request with the specified parameters.
Parameters
  • \ReCaptcha\RequestParameters $params Request parameters
Returns
  • string Body of the reCAPTCHA response
Since
  • 3.9.0

Method submit - Source code

/**
 * Submit the request with the specified parameters.
 *
 * @param   RequestParameters  $params  Request parameters
 *
 * @return  string  Body of the reCAPTCHA response
 *
 * @since   3.9.0
 */
public function submit(RequestParameters $params)
{
    try {
        $response = $this->http->post(self::SITE_VERIFY_URL, $params->toArray());
        return (string) $response->getBody();
    } catch (InvalidResponseCodeException $exception) {
        return '';
    }
}