Using PHP to output a text version of a page
Posted: Mon Sep 28, 2009 7:50 pm
I would like give the visitors of my site the ability to view my pages in a plain text format (for accessibility reasons). I am aware that sending a page with a mime type of text/plain will result in a such a page. I was hoping to have PHP look for a string in the page URL and send different mime types when seeing different strings.
For example, if the URL was http://www.example.com/index.php?output=text, then it would send the page using the text/plain mime type. However, if the URL was http://www.example.com/index.php?output=html, the mime type would be text/html.
What would be an example of some PHP code which could be used perform this task?
For example, if the URL was http://www.example.com/index.php?output=text, then it would send the page using the text/plain mime type. However, if the URL was http://www.example.com/index.php?output=html, the mime type would be text/html.
What would be an example of some PHP code which could be used perform this task?