Back to index

php5  5.3.10
cleanhtml5.php
Go to the documentation of this file.
00001 <?php
00002 
00003     /*
00004      * cleanhtml5.php
00005      *
00006      * A simple script to clean and repair HTML,XHTML,PHP,ASP,etc. documents
00007      * if no file is provided, it reads from standard input.
00008      *
00009      * NOTE: Works only with tidy for PHP 5, for tidy in PHP 4.3.x see cleanhtml.php
00010      *
00011      * By: John Coggeshall <john@php.net>
00012      *
00013      * Usage: php cleanhtml5.php [filename]
00014      *
00015      */
00016     
00017     if(!isset($_SERVER['argv'][1])) {
00018       $data = file_get_contents("php://stdin");
00019       $tidy = tidy_parse_string($data);
00020     } else {
00021       $tidy = tidy_parse_file($_SERVER['argv'][1]);
00022     }
00023     
00024     $tidy->cleanRepair();
00025     
00026     if(!empty($tidy->errorBuffer)) {
00027         
00028         echo "\n\nThe following errors or warnings occured:\n";
00029         echo "{$tidy->errorBuffer}\n";
00030         
00031     }
00032     
00033     echo $tidy;
00034     
00035 ?>
00036     
00037         
00038      
00039