You are here

function example_http_header_functions in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/tests/old/samples/example.module \example_http_header_functions()

File

coder_upgrade/tests/old/samples/example.module, line 202

Code

function example_http_header_functions() {

  // drupal_set_header() -- Change the next line but leave this alone
  drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error');
  drupal_set_header('HTTP/1.1 503 Service unavailable');
  drupal_set_header('HTTP/1.1 403 Forbidden');
  drupal_set_header('Content-Type: text/plain');
  drupal_set_header('Content-Type: text/javascript; charset=utf-8');
  drupal_set_header('Content-Type: octet/stream');
  drupal_set_header('Content-Disposition: attachment; filename="' . $filename . '"');
  drupal_set_header('Content-Length: ' . filesize(file_directory_path() . '/' . $filename));

  // Double quotes.
  drupal_set_header($_SERVER["SERVER_PROTOCOL"] . " 500 Internal server error");
  drupal_set_header("HTTP/1.1 503 Service unavailable");
  drupal_set_header("HTTP/1.1 403 Forbidden");
  drupal_set_header("Content-Type: text/plain");
  drupal_set_header("Content-Type: text/javascript; charset=utf-8");
  drupal_set_header("Content-Type: octet/stream");
  drupal_set_header("Content-Disposition: attachment; filename='" . $filename . "'");
  drupal_set_header("Content-Length: " . filesize(file_directory_path() . "/" . $filename));

  // drupal_get_headers() -- Change the next line but leave this alone
  $headers = drupal_get_headers();
  foreach (drupal_get_headers() as $name => $value) {

    //
  }
}