Skip to content Skip to sidebar Skip to footer

Save Output Of A Php File In A Html File

I am having a php file which executes some code to generate a html file.Its like I m having a form from which some data will be posted to x.php file, which gives a output(a webpage

Solution 1:

Try something like this:

// Start output bufferingob_start();
// run code in x.php file// ...// saving captured output to filefile_put_contents('filename.htm', ob_get_contents());
// end buffering and displaying pageob_end_flush();

If you cannot use the ob_* functions, you can also write the form to a variable and then save that variable.

Solution 2:

Look at ob functions (see http://php.net/manual/en/function.ob-start.php) that allows you to capture every output (echo, print, etc...) from the page.

Solution 3:

using ob_* functions such as ob_get_contents(), a php script can catch it's output.

Solution 4:

probably with ob_start and output_callback see http://php.net/manual/en/function.ob-start.php

Post a Comment for "Save Output Of A Php File In A Html File"