You are here

class Drupal6Post in reCAPTCHA 6.2

Sends POST requests to the reCAPTCHA service.

Hierarchy

Expanded class hierarchy of Drupal6Post

File

src/ReCaptcha/RequestMethod/Drupal6Post.php, line 16
Custom Drupal 6 RequestMehod class for Google reCAPTCHA library.

Namespace

ReCaptcha\RequestMethod
View source
class Drupal6Post implements RequestMethod {

  /**
   * URL to which requests are POSTed.
   * @const string
   */
  const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';

  /**
   * Submit the POST request with the specified parameters.
   *
   * @param RequestParameters $params Request parameters
   * @return string Body of the reCAPTCHA response
   */
  public function submit(RequestParameters $params) {
    $response = drupal_http_request(self::SITE_VERIFY_URL, array(
      'Content-type' => 'application/x-www-form-urlencoded',
    ), 'POST', $params
      ->toQueryString());
    return isset($response->data) ? $response->data : '';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drupal6Post::SITE_VERIFY_URL constant URL to which requests are POSTed. @const string
Drupal6Post::submit public function Submit the POST request with the specified parameters. Overrides RequestMethod::submit