Som PHP
<?php
$html = <<<HTML
<body>
<style dddffr sdfvsf></style>
<bR><span><span><div>
</body>
HTML;
$fields = array(
'_function' => 'tidy',
'_url' => 'http://',
'_html' => urlencode($html),
'alt-text' => '',
'doctype' => 'auto',
'drop-empty-paras' => 'y',
'fix-backslash' => 'y',
'fix-bad-comments' => 'y',
'fix-uri' => 'y',
'join-styles' => 'y',
'lower-literals' => 'y',
'ncr' => 'y',
'new-blocklevel-tags' => '',
'new-empty-tags' => '',
'new-inline-tags' => '',
'new-pre-tags' => '',
'output-xhtml' => 'y',
'quote-ampersand' => 'y',
'quote-nbsp' => 'y',
'indent' => 'auto',
'indent-spaces' => 2,
'tab-size' => 4,
'wrap' => 90,
'wrap-asp' => 'y',
'wrap-jste' => 'y',
'wrap-php' => 'y',
'wrap-sections' => 'y',
'ascii-chars' => 'y',
'char-encoding' => 'ascii',
'input-encoding' => 'utf-8',
'output-bom' => 'auto',
'output-encoding' => 'utf-8',
'_output' => 'warn'
);
$fields_string = '';
foreach($fields as $key=>$value) {
$fields_string .= $key.'='.$value.'&';
}
rtrim($fields_string,'&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, '
http://infohound.net/tidy/tidy.pl');
curl_setopt($ch,CURLOPT_HEADER, TRUE);
curl_setopt($ch,CURLOPT_NOBODY, false); // remove body
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1');
curl_setopt($ch,CURLOPT_HEADER,false);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result = curl_exec($ch);
curl_close($ch);
echo $result;