SHARE
TWEET

Trim CSS, HTML, JS

qwidjib0 Jun 15th, 2016 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?
  2.  
  3. $filename = "all.txt";  // File name here
  4.  
  5. // Trim it
  6. $myfile = fopen($filename, "r") or die("Unable to open file!");
  7. $text = fread($myfile,filesize($filename));
  8. $text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $text);
  9. $text = preg_replace('#<style(.*?)>(.*?)</style>#is', '', $text);
  10. $text = strip_tags($text);
  11.  
  12. // Save it
  13. $newfile = fopen("trimmedtext.txt", "w") or die("Unable to open file!");
  14. fwrite($newfile, $text);
  15. fclose($myfile);
  16. fclose($newfile);
  17.  
  18. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top