WireHttp::setHeaders() method

Set an array of request headers to send with GET/POST/etc. request

Merges with existing headers unless you specify true for the $reset option 3.0.131. If you specify null for any header value, it removes the header 3.0.131.

Usage

// basic usage
$http->setHeaders(array $headers);

// usage with all arguments
$http->setHeaders(array $headers, array $options = []);

Arguments

NameType(s)Description
$headersarray

Associative array of headers to set

$options (optional)array

Options to modify default behavior 3.0.131:

  • reset (bool): Reset/clear all existing headers first? Default:false
  • replacements (array): Associative array of [ find => replace ] values to replace in header values Default:[]

Return value

$this

Object instance it was called from (method supports fluent interface).


$http methods and properties

API reference based on ProcessWire core version 3.0.252