I have a simple website in PHP.
My website does not use any Data Source, just some simple PHP scripts to allow some basic functionality.
As for my understanding when a User request my website the PHP code generates the HTML code that will be read by their browser.
I need to make difficult (in some how obfuscate) the HTML generated, so if the user would save a HTML page the code would be difficult to modify and uneasy to interpreter.
My basic need are basically COMPRESSING the HTML:
- Eliminate white space. So all code would be packed in few line. Making it in some how human unreadable
- Encode the HTML (optional)
Because I have many pages in my website. I’m looking for an automatic solution so I can add some code in one place and have for the next moment all pages output as described above.
Any idea how to do it?
Thanks for your time.
You can use eval function: http://php.net/manual/en/function.eval.php or output buffering: http://php.net/manual/en/book.outcontrol.php and than modify the result. But obfuscating HTML itself is pointless. There are many tools for code formating capable of reverting the code to human-friendly form.
If you want the result to by hard to change, why don’t you output a PDF file?