Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Is there a way to remove html entities?

Posted on 2009-04-23
5
Medium Priority
?
1,282 Views
Last Modified: 2013-12-12
In a script I try to use a html page to produce a .doc file. The html page is derived from a database. Right now the html code is written as it is to the file. I would like to remove the html code and use only the basic text. Is that possible?
0
Comment
Question by:Lennart Ericson
5 Comments
 
LVL 1

Expert Comment

by:krv123
ID: 24218043
0
 
LVL 13

Expert Comment

by:Xyptilon2
ID: 24218271
Yes, you can use the strip_tags functions:

http://uk.php.net/strip_tags

<?php
$sHTML = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';

echo strip_tags($sHTML);
?>
0
 

Author Comment

by:Lennart Ericson
ID: 24218787
I meant the output to be like it is rendered by a browser. All html code need to be removed.
0
 
LVL 14

Accepted Solution

by:
shobinsun earned 1500 total points
ID: 24221918
Hi,

this is the thing you need:

http://in2.php.net/strip-tags

Regards
0
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 1500 total points
ID: 24221925
Hi,

A very good tutorial is here:

http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page

Thanks and Regards
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question