title: drupal 6 can we write a php file in drupal which changes the headers
body: <p>i have written a small code which creates a word document but 
  i got the following errors</p>
  
  <p>
  
  <p>require_once './includes/bootstrap.inc';
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  global $user;</p>
  
  <pre><code>$fp = fopen("test.doc", 'w+');
  $str = "&lt;B&gt;This is the text for the word file created through php programming&lt;/B&gt;&lt;br&gt;test to create a doc file from php";
  ob_start();
      include('index.php');
      $result = ob_get_clean();
  
  fwrite($fp, $result);
      echo "executed";
  </code></pre>
  
  <p>header("Content-Disposition: attachment; filename=test.doc");
  header("Content-Type: application/force-download");
  header("Content-Length: " . filesize("test.doc"));
  header("Connection: close");</p>
  
  <pre><code>fclose($fp);
  </code></pre>
  
  <p>?>
  warning: Cannot modify header information - headers already comnt by (output started at /var/www/www.example.com/htdocs/test_createdoc.php:6) in /var/www/www.example.com/htdocs/test_createdoc.php on line 19.
  warning: Cannot modify header information - headers already comnt by (output started at /var/www/www.example.com/htdocs/test_createdoc.php:6) in /var/www/www.example.com/htdocs/test_createdoc.php on line 20.
  warning: Cannot modify header information - headers already comnt by (output started at /var/www/www.example.com/htdocs/test_createdoc.php:6) in /var/www/www.example.com/htdocs/test_createdoc.php on line 21.
  warning: Cannot modify header information - headers already comnt by (output started at /var/www/www.example.com/htdocs/test_createdoc.php:6) in /var/www/www.example.com/htdocs/test_createdoc.php on line 22</p>
  
  <p><strong>i have even remove the white spaces between php tags</strong></p>