I have 3 files called Casino-review.php, functions.php, newfile.html. My problem is when i am creating a html file called newfile.html from functions.php and copying php output data from casino-review.php in the newfile.html. It's working properly good but, when the functions.php creating html file and copying data in it, It's not showing header.php and footer.php i don't know why. I think you know what i am saying.
I mean when newfile.html is created it's not showing header and footer this is not an error this an problem that i don't know how to fix i have tried googling so many times but didn't find any solutions. I hope you understand me.
Note: This is not error everything is fine.
The first one is Casino-review.php and it's code is.
<?php
require 'header.php';
?>
<h1><?php echo "Hello world"; ?></h1>
<?php
require 'footer.php'
?>
The second file functions.php and it's code is.
$fileName = "wow.html";
$to = "casinos/all/".$fileName;
$from = "casinos/casino-review.php";
if ($createFile = fopen($to, "w")) {
ob_start();
require_once("$from"); // Getting php output from Casino-review.php
file_put_contents($to, ob_get_contents());
ob_end_clean();
fclose($createFile);
echo "Wait for 5 seconds";
}
The third file is newfile.html and it's code is.
// Header is not including
<h1>Hello world</h1>
// Footer is not including