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?
Using PHP to output a text version of a page
Moderator: General Moderators
-
octavian_3009
- Forum Newbie
- Posts: 9
- Joined: Tue Feb 24, 2009 6:28 pm
Re: Using PHP to output a text version of a page
But you're serving the exact same content?
Re: Using PHP to output a text version of a page
Use $_GET and header().
You might want to use OB and strip_tags() as well unless you want users to see all the HTML tags.
You might want to use OB and strip_tags() as well unless you want users to see all the HTML tags.
-
octavian_3009
- Forum Newbie
- Posts: 9
- Joined: Tue Feb 24, 2009 6:28 pm
Re: Using PHP to output a text version of a page
Thank you for the mention of strip_tags(). I had completely forgotten about that.