p
This first example will walk you through the process for setting up HObfus in a PHP page. We will explain how to set up %app-name% in a PHP page so the HTML code generated by the PHP page gets obfuscated when opened in a browser. We will use the following PHP page as an example to show how to use %app-name%.

code
&lt;!doctype html&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;meta charset="utf-8"&gt;
		&lt;title&gt;My PHP Page&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;?php echo "The current time is ".date("Y-m-d H:i:s"); ?&gt; 
	&lt;/body&gt;
&lt;/html&gt;
/code

ts
Specify code to obfuscate

p
To specify the code that you want to obfuscate, enclose it inside k^&lt;?php HObfus_begin(); ?&gt;$ and k^&lt;?php HObfus_end(); ?&gt;$. In this example, we will obfuscate the entire page, so insert k^&lt;?php HObfus_begin(); ?&gt;$ and k^&lt;?php HObfus_end(); ?&gt;$ at the beginning and the end of the file, respectively, as shown below.

code
kh^&lt;?php HObfus_begin(); ?&gt;$
&lt;!doctype html&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;meta charset="utf-8"&gt;
		&lt;title&gt;My PHP Page&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;?php echo "The current time is ".date("Y-m-d H:i:s"); ?&gt; 
	&lt;/body&gt;
&lt;/html&gt;
kh^&lt;?php HObfus_end(); ?&gt;$
/code

p
The HTML code generated between k^&lt;?php HObfus_begin(); ?&gt;$ and k^&lt;?php HObfus_end(); ?&gt;$ will be obfuscated when the PHP page is opened in a browser.

ts
Include HObfus.inc.php

p
Before testing the PHP page, there is one more thing to be done. In the previous step, you added two functions: k^HObfus_begin()$ and k^HObfus_end()$ to the PHP page. These functions are declared in the file, b^hobfus/HObfus.inc.php$, which you installed in the l^installation|installation$ page. To make the functions available to your PHP page, you need to include b^hobfus/HObfus.inc.php$ using the b^require_once()$ function, like shown below. 

code
kh^&lt;?php require_once("<i>PATH-TO-HObfus.inc.php</i>"); ?&gt;$
&lt;?php HObfus_begin(); ?&gt;
&lt;!doctype html&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;meta charset="utf-8"&gt;
		&lt;title&gt;My PHP Page&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;?php echo "The current time is ".date("Y-m-d H:i:s"); ?&gt; 
	&lt;/body&gt;
&lt;/html&gt;
&lt;?php HObfus_end(); ?&gt;
/code

p
You must replace b^<i>PATH-TO-HObfus.inc.php</i>$ with the actual path to b^hobfus/HObfus.inc.php$. If you are not sure about the path, see l^path-to-hobfus|Find the path to HObfus.inc.php$ for more help.

p
The position of b^require_once()$ is usually at the top of the PHP file, however, you can place it anywhere as long as it comes before the first k^&lt;?php HObfus_begin(); ?&gt;$.

ts
Test your PHP page

p
Now you are ready to test it. Open the PHP file in your browser and check the source. You should find that the HTML source code is obfuscated.

tpl
std
