Alterable HTTP Request
Component ID
2070657
Component name
Alterable HTTP Request
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
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));
}
