HObfus v2.04
$cfg["return-output"]

$cfg["return-output"] controls whether HObfus_end() should output obfuscated code to the browser or return it as a PHP string.

If $cfg["return-output"] is 0, HObfus_end() will output obfuscated code to the browser.

$cfg["return-output"]=0;

If $cfg["return-output"] is 1, HObfus_end() will return obfuscated code as a PHP string.

$cfg["return-output"]=1;

For example, the following code will assign the obfuscated code to a PHP variable named '$my_code':

$my_code=HObfus_end();

It is up to you how you utilize the value of the variable. You may want to save it to a file and use it at a later time.

It is very rare that you want to set $cfg["return-output"] to 1 in the configuration file. Instead, you would rather want to override it in HObfus_begin() like:

HObfus_begin(array(
  "return-output"=>1
));

The default value of $cfg["return-output"] is 0 (disabled).

$cfg["return-output"]=0;
Example

The following PHP source code demonstrates the use of return-output. It captures obfuscated JavaScript code and saves it to a file.

<?php

// Set up the path to HObfus.inc.php
$path_to_HObfus="";

if(empty($path_to_HObfus)){
	die("Please set up the path to HObfus.inc.php!");
}

// Load HObfus.inc.php
require_once($path_to_HObfus);

// Set "return-output" to 1 in HObfus_begin()
HObfus_begin(array("return-output"=>1));

?>

<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Example HTML</title>
	</head>
	<body>
		<h1>This is a test HTML page!</h1>
	</body>
</html>

<?php

// Capture obfuscated JavaScript code in a PHP variable named $my_code
$my_code=HObfus_end();

// Save the code to a file named "my_code.html"
file_put_contents("my_code.html",$my_code);

?>
Done!

At a later time, you may want to output the code to the browser. For example,

<?php

// Load the code from a file named "my_code.html"
$my_code=file_get_contents("my_code.html");

// Output the code to the browser
echo $my_code;

?>

« Back
$cfg["remove-comment"]
Next »
Overriding Configurations