Jump to content

write out HTML from PHP


ultraloveninja

Recommended Posts

Ok, so I've been trying to find what I need and I have not really been able to come across anything that looks like it does the trick.

I am looking to write out and HTML file based on what gets parsed out by the PHP page. For example, the PHP page redenders out a table of information, and if I go to view source, it will show all of the HTML that has been written out by the PHP page.

My question is how do I take the HTML that is written out by the PHP page and create a HTML file?

 

I've seen some things with fopen and fwrite, but it's not writing out anything:

 

<?php
$my_file = "index.php";
$end_file = "test_index.html";
$fh = fopen($my_file,'r') or die("can't open file");
fwrite($fh, $end_file);
echo "File succesfully written";
?>

 

Am I on the right track???

Link to comment
https://forums.phpfreaks.com/topic/126508-write-out-html-from-php/
Share on other sites

Like this:

 

<?php
$my_file = "index.php";
$end_file = "test_index.html";
$fh = fopen($my_file,'r') or die("can't open file");
fread($fh, echo $end_file);
echo "File succesfully written";
?>

 

Sorry, still pretty green to syntax formatting and what not.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.