Jump to content

Help saving dynamic page to a static file


diar33

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,

Travis
Link to comment
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:
[code]
<?php
$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);
fclose($handle);
?>
[/code]

Is this the sort of thing you were looking for?
Link to comment
Share on other sites

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.