Jump to content


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


Help saving dynamic page to a static file

Recommended Posts

Hi everyone,

I am having quite a bit of trouble with a small project of mine. What I am trying to do is take an existing html result page (comes from php, pulls lots of stuff from a database and requires authentication) and turn it into a file I can attach to an e-mail. I would really prefer .pdf, but .doc or .html would be fine. I got it to work with .doc using mime-types and some word xml, but it looks terrible. I also tried .html using curl to open the page and write it to a file, but I couldn't get it to pass the authentication.

Any ideas how I can do this?

To summarize: I just want to be able to send a member of the site a record of their information. If it would be helpful to know more about my specific problem, please let me know.

Thanks in advance,


Share this post

Link to post
Share on other sites
Well it seems like the html file ought to be fairly easy.

I'm having a hard time understanding exactly where the information is comming from, but if I understand right, you want something like:
$username = $_POST['username'];
$userinfo1 = $_POST['userinfo1'];
$userinfo2 = $_POST['userinfo2'];
$html="<html><head><title></title></head><body><h1>This is Important User Information:</h1><table><tr><td>Piece of Information #1</td><td>$userinfo1</td></tr><tr><td>Piece of Information #2</td><td>$userinfo2</td></tr></table></body></html>";

$handle = fopen($username.".html", "w");
fwrite($handle, $html);

Is this the sort of thing you were looking for?

Share this post

Link to post
Share on other sites


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.