note 33364 deleted from ref.outcontrol by nlopess
| From: | nlopess@php.net | Date: | Mon, 05 Jan 2004 16:06:05 +0000 |
| Subject: | note 33364 deleted from ref.outcontrol by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62957@lists.php.net to get a copy of this message | ||
Note Submitter: jharris@rallycentral.us
----
To parse your output through HTMLtidy where PHP=>4.3.2, it is important to know about the fread()
bug (http://bugs.php.net/bug.php?id=24033). Previous versions had a bug which made the code
"work as expected." In addition to fixing this bug, there are some others in the HTMLtidy
parsing script posted here.
$gmt_modtime=gmdate('D, d M Y H:i:s', filemtime("/home/user/script.php") ).
' GMT';
$str=addslashes(ob_get_contents());
$fp=popen("echo \"" . $str . "\" | /usr/bin/tidy -config
/home/user/htmlrc", "r");
$newstr="";
do {
$data = fread($fp, 999999);
if (strlen($data) == 0) {
break;
}
$newstr .= $data;
}
pclose($fp);
ob_end_clean();
header("Last-Modified: " . $gmt_modtime);
header( "Content-length: " . strlen( stripslashes( $newstr ) ) );
echo stripslashes($newstr);
exit;