You are here

function _hotjar_get_headers in Hotjar 6

Get all headers.

1 call to _hotjar_get_headers()
_hotjar_check_status in ./hotjar.module
Check current request HTTP status.

File

./hotjar.module, line 216
Drupal Module: Hotjar.

Code

function _hotjar_get_headers() {
  $header_array = array();
  $headers = drupal_get_headers();
  $exploded_headers = explode("\n", $headers);
  foreach ($exploded_headers as $h) {
    $matches = array();
    preg_match('/^(.+):(.*)$/', $h, $matches);
    if (count($matches) > 2) {
      $header_array[strtolower($matches[1])] = trim($matches[2]);
    }
  }
  return $header_array;
}