And Generating file to store HTML code.
Let's go through the example
URL: example.com/report.php?date=2018-01-06
Here the complete code of generating HTML Source code dynamically in PHP
$url = 'report.php';
ob_start();
$original_get = $_GET;
$_GET = ["date" => "2018-01-06", "you" => "need", "in" => "report.php"];
include($url);
$html = ob_get_contents();
ob_end_clean();
echo "=====". $html;
$fName = rand(10000,99999).".txt";
$myfile = fopen("report/".$fName."", "w");
fwrite($myfile, $html);
fclose($myfile);
No comments:
Post a Comment