Requests has a hook system that you can use to manipulate parts of the request process along with internal transport hooks.

Check out the API documentation for Requests_Hooks for more information on how to use the hook system.

Available Hooks

Registering Hooks

Note: if you’re doing this in an authentication handler, see the Custom Authentication guide instead.

In order to register your own hooks, you need to instantiate Requests_Hooks and pass the object in via the 'hooks' option.

$hooks = new Requests_Hooks();
$hooks->register('requests.after_request', 'mycallback');

$request = Requests::get('https://httpbin.org/get', array(), array('hooks' => $hooks));

Previous: Requests through proxy