Let’s say I open this this page http://localhost/test/index.php and give me this output:
<p>test</p>
<p>second test</p>
The page header is plain text so it will not display the html formatted
header("Content-Type: plain/text");
Question is how do I automatically grab the plain text content and write it into text file and save it in the web server. For example is http://localhost/test/grab/text1.txt
“EDIT”
“Save the files contents to somewhere on the webserver, not ask the client to save it”…
Assuming you’ve phrased your question correctly, and you actually want to save on server instead of client.
You could use output buffering to capture the output and then save it in a file of your choosing
http://www.php.net/manual/en/function.ob-start.php
An example from the manual page (changed to save the file)
?>