Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.