title: php export text file without meta data
body: <p>I have a string which contains data from a SQL query, and I try to export it to text file. But I only want the columns <code>name</code> and <code>data</code>, I do not want the meta data. I used the following code:</p>
  
  <pre><code>header('Content-type: application/txt');
  header('Content-Disposition: attachment; filename="day2.txt"');
  echo "$header\n$data";
  </code></pre>
  
  <p>The output is like the following. How can I get only the content inside the <code>body</code>? I do not want the <code>html</code> tag.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;"1340129" "2013-04-08" "true" "true"&lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>