Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Exposes two new alter-hooks operating on the parameters as well as on the result of drupal_http_request.

Example implementation

/**
 * Implements hook_ahr_http_request_alter().
 */
function ahr_example_ahr_http_request_alter(&$url, &$options) {
  $handler = variable_get('ahr_http_request_function', 'drupal_http_request');
  watchdog('AHR Example', 'Attempting to retrieve %url using %handler', array('%url' => $url, '%handler' => $handler));
}

/**
 * Implements hook_ahr_http_response_alter().
 */
function ahr_example_ahr_http_response_alter(&$result, &$url, &$options) {
  $timer = variable_get('ahr_http_request_function', 'drupal_http_request');
  $seconds = timer_read($timer) / 1000;
  watchdog('AHR Example', 'Retrieval of %url took %seconds seconds.', array('%url' => $url, '%seconds' => $seconds));
}

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Module categories: Developer, Utility