开发者

Use HTML Tidy executable with php, instead of compling

I have an application in php that is intended for shared hosting. So, I am going to have a hard time always getting html tidy compiled, since the hosts will vary, and what they provide will v开发者_C百科ary.

Is it possible to just include the tidy executable in with my php application, and somehow, pipe html through that for cleaning?

I am just looking for a way to have html tidy bundled with my app, and not have to install or compile it after.

Thanks.


Since the Tidy extension is a binding for the Tidy HTML clean and repair utility, I don't think this will work without compiling the Tidy utility on the destination server (not entirely sure though). If the utility is installed (but not the extension), you might be able to use Tidy through the command line, so you could try

 system( 'tidy -f errs.txt -m index.html' );

For shared hosts not offering Tidy, you could use HTMLPurifier as a standalone alternative. It's also somewhat more feature-rich than Tidy:

HTML Purifier is a standards-compliant HTML filter library written in PHP. HTML Purifier will not only remove all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only achievable with a comprehensive knowledge of W3C's specifications.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜