Pass value to a php file to change the text inside the file then force download the same file
<p>Download link:</p>

<pre><code>&lt;a href="download.php?words=2000&amp;sort=popular&amp;type=xml"&gt;Download php file&lt;/a&gt;
</code></pre>

<p>download.php</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Home&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;PHP file&lt;/h1&gt;

&lt;?php
function get_text($text)  
{  
   ....
}      

function get_time($time)  
{  
   ....
}    

$url = "http://api.xxx.com/info.php?words=".$_GET['words']."&amp;sort=".$_GET['sort']."&amp;type="$_GET['type'];
$xml = simplexml_load_file($url);
if (count($xml))
{
  foreach($xml-&gt;book as $book)
  {
    echo ....      
  }
}
?&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The download.php is a ready made API php script to provide webmasters upload to their FTP. Webmasters can be choose many options(e.g: download.php?words=2000&amp;sort=popular&amp;type=xml) from a form, then submit the form to get their custom API script.</p>

<p>This is the line that will replace the options after they submit the form.: </p>

<pre><code>$url = "http://api.xxx.com/info.php?words=".$_GET['words']."&amp;sort=".$_GET['sort']."&amp;type="$_GET['type'];
</code></pre>

<p>This is the code to force download. But i don't know how to wrap whole page with $content = "";. I know how to wrap the HTML codes but how to wrap the PHP function and codes on the page?</p>

<pre><code>header("Content-Disposition: attachment; filename="download.php");
print $content;
</code></pre>
