PHP strip_tags() problem?

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


22 points

I am trying to strip all HTML tags from HTML document using PHP strip_tags. It does not work:

Here is my script :

<?php
<?
$file=readfile("http://server/file.html";);
if (!(
$string strip_tags($file))) print "<br> error ! <br>";
$strings strtolower($string);
print 
"strings: $strings";
?>

It doesn't lower case anything and it does not strips tags at all. Obviously there is something I am missing here, but what ?

Thanks for your thoughts



10 points

In your script, user php fopen() or php fread() instead of php readfile(). I think that is the problem.

Your php strip_tags() looks correct.

Anonymous's picture
Created by Anonymous
6 points

Thanks. fread() worked for me.

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.