Hooking system

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 WpOrg\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 WpOrg\Requests\Hooks and pass the object in via the 'hooks' option.

$hooks = new WpOrg\Requests\Hooks();
$hooks->register('requests.after_request', 'mycallback');

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

Previous: Requests through proxy

Next: Upgrading to Requests 2.0