How tidy Works
The most basic use of tidy within PHP is divided accross three functions:

Cleaning up http://www.php.net/
<?php
    tidy_parse_file
("http://www.php.net/");
    
tidy_clean_repair();
    echo 
tidy_get_output();
?>