Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $filename = "all.txt"; // File name here
- // Trim it
- $myfile = fopen($filename, "r") or die("Unable to open file!");
- $text = fread($myfile,filesize($filename));
- $text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $text);
- $text = preg_replace('#<style(.*?)>(.*?)</style>#is', '', $text);
- $text = strip_tags($text);
- // Save it
- $newfile = fopen("trimmedtext.txt", "w") or die("Unable to open file!");
- fwrite($newfile, $text);
- fclose($myfile);
- fclose($newfile);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement